I am creating a time and attendance application. I used the template. The app will allow a contractor to add his employees and when they arrive at work, their time will be recorded. This works fine until I add another contractor. How do I restrict the contractors from seeing only their data.
I have a table call team with id, name, email columnsโฆ (the email column is the user who will login in)
I also have an employee table with empid, name, company
I followed the documentation and tried this filter.
IN(Employees [Company], SELECT(Team [Id], [emailaddress] = USEREMAIL()))
What I am trying to do is to for the user that is logged in to see only the employees that are in his company.
I must mention that as a ref it is working from the teams view. I want to filter the employees view.
Solved! Go to Solution.
Please check this sample app how itโs done called โHorizontal Scaleโ from www.appsheet.com/portfolio/531778
This is what I have been using to reach this far.
@Brent_Meade
You should have user mail column in your form with initial value USERMAIL().
Try use slice to filter users to view particular columns.
I thought about that , but I cant build a dynamic slice base on the user that is login.
Soโฆ you want to show employees table and itโs records only for people that donโt belong to your Team table. Is that what you are looking for?
noโฆ
The logged user must see only his employees.
If the team is already filtered in a correct way with a security filter, then itโs something like IN([Company],Team[Company])
No my team is not filtered. That is the problem I am trying to solve.
How the app actually worksโฆ are employees able to use the app or just contractors?
I want only contractors to see their data. The contractor will login to the system. I created a team page. From that page it was simple to filter the record by useremail() asthe team table has a column for email. This view allows the associated employees to show via a ref_row. The problem is when I go to the employee view via the menu, the contractor can see all employees. I want them again to see only their employees. In the employee table there is a relationship between the employee and team using the companyID. I need to filter by the email and companyID of the login contractor on the employee table. I can then use the same expression on the timesheet table.
When you have the security filter with your Team table as USEREMAIL()=[Email], it will filter your table and the result is probably only one record. Then you can filter your Employee table like IN([companyID],Team[ID])
Did not work. I was expecting it to return only the company where the id is 3.
Side suggestion: Maybe someone could make a good demo application that shows how to make an staffing app combine with different security levels/policies? I see someone else has a similar query:
it suggests there is a absence of documentation and examples over what might be a rather standard set of features used in organization that is using Appsheet for its solutions.
Hmm, this sounds like a interesting challenge. I might take it up later tonight or tomorrow.
Add this fresh topic too:
You hit more than 2 birds with 1 stone, so-to-speakโฆ
Please check this sample app how itโs done called โHorizontal Scaleโ from www.appsheet.com/portfolio/531778
You need to post that in the topic: " Make it disable to certain people"
Thank you it worked.
Youโre welcome
@aucforum does this sample app I made do what you were thinking? Youโll need to look under the hood to do pretty much anything.
https://www.appsheet.com/samples/Incident-Reports?appGuidString=62b2764f-f95a-460e-8171-63d486287210
Wow, this is amazing. I never thought all this level of security was possible. Thanks for the eye opener. I will try to apply
OR(USEREMAIL()=AppOwner@business.com,USEREMAIL()=table[UserID])
This security filter allows the application owner to read all records, while individual users can only see their own records.
Your expression is invalid.
OR(USEREMAIL()=AppOwner@business.com, IN(USEREMAIL(), table[UserID]))
User | Count |
---|---|
41 | |
31 | |
31 | |
16 | |
14 |