Help request for security filtering

Brent_Meade
Participant II

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 Solved
0 26 1,001
1 ACCEPTED SOLUTION

Please check this sample app how itโ€™s done called โ€œHorizontal Scaleโ€ from www.appsheet.com/portfolio/531778

View solution in original post

26 REPLIES 26

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])

2X_8_89e1c9de824f703be819257bfc8851283ce88d0d.png

Did not work. I was expecting it to return only the company where the id is 3.

aucforum
Participant V

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

Bahbus
Participant V

@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]))

@Bahbus @Steve
Thank you about the correcting.

Top Labels in this Space