Hi Guys
I want to change my Security Filter:
OR([Salesperson]=USEREMAIL(),USEREMAIL()=โImTheAdmin@gmail.comโ)
In all tables is a column [Branch] which a unique Branch Name is generated by all tables with a default value.
I only want a user to see data relating to his own Branch.
Would my security filter be:
OR([Branch]=[Branch],USEREMAIL()=โImTheAdmin@gmail.comโ)
Better:
IN(USEREMAIL(), LIST([Salesperson], โImTheAdmin@gmail.comโ))
How does the app know with which branch a particular salesperson is associated?
Thats a point Steve.
The filter:
OR([Salesperson]=USEREMAIL(),USEREMAIL()=โImTheAdmin@gmail.comโ)
Will only allow the user to see their own data and the second part โImTheAdmin@โ which is me gives me access to everyones data.
[Branch] Is recorded in all tables, ie MMVR or STOKE and that is generated by using DEFAULT VALUE in every row.
Ideally the user can see all rows specific to his branch regardless of users with different email addresses. Pretty much like a domainโฆ
So thats where Iโm stuck?
How does the app know with which branch a particular salesperson is associated?
Hmm, thinking rationally it canโt know unless I specifically name the branch in the filter:
OR([Branch]=โMMVRโ,USEREMAIL()=โImTheAdmin@gmail.comโ)
OR([Branch]=โSTOKEโ,USEREMAIL()=โImTheAdmin@gmail.comโ)
Is that the recommended way?
The app can only work with the information available to it. If thereโs no way to tie the current user (via USEREMAIL()) to a branch identifier, thereโs no way for the app to determine which branch the user is associated with, and therefore no way to determine whether any given row should be displayed to the user.
An alternative is to allow the user to identify their branch with a user setting, but that would also allow them to change their branch, which might give them access to information they shouldnโt have.
See also:
There is an Admin View which holds all the Branches which only I can see using a SHOW_IF with a filter of: USEREMAIL()=โImTheAdmin@gmail.comโ
I think I forgot to say I have a Master App and copy that for each branch who want to use the app. In each app the Column [Branch] has to be changed before I allow that branch to have access. So if I had a new branch say โLONGTONโ I would change the INITIAL VALUE for [Branch] to โLONGTONโ
Plus [Branch] is hidden from every view so the user doesnโt even know it is recorded.
Please post a screenshot of the column list from Data >> Columns in the app editor for the table to which you want to apply this security filter.
[BRANCH] = โWrexhamโ
or
[BRANCH] = โMMVRโ
OR([Branch]=โWrexhamโ,USEREMAIL()=โImTheAdmin@gmail.comโ)
Ah, okay. Youโll need to hard-code the branch identifier in the slice row filter expression, just as youโve hard-coded the value in the column configuration, as you suggested above. E.g.:
OR([Branch]=โMMVRโ,USEREMAIL()=โImTheAdmin@gmail.comโ)
Thanks Steve, really appreciate the assistance.
User | Count |
---|---|
39 | |
35 | |
29 | |
23 | |
18 |