How to restrict users list to the company of the logged in user

Hello I have an app with groups so I have a security filter that restricts the information to that particular group based on the user that’s logged in. The security filter is: LOOKUP(USEREMAIL(),“group_users”,“user”,“group”)=[group_id]

Question 1: Is there a less expensive expression I can use?
Question 2: I now have to restrict the “group_users” table to only show users in the logged in user’s company.

The above expression no longer works of course as we’re IN the table so it would be great if we use something like LOOKUP(USEREMAIL(),[_THIS],“user”,“group”)=[group_id] but that doesn’t work either.

Any ideas?

Thank you

You could add a column with all emails of the group as an ENUMLIST and check if USEREMAIL() is in that column

1 Like

Isn’t the filter just
[user] = USEREMAIL()

What concerns do you have about the current one? The only question that jumps to mind for me is can the user belong to more than one group?

If by “company” you mean “email domain” (the part after the at sign (@)):

(
  INDEX(SPLIT(USEREMAIL(), "@"), 2)
  = INDEX(SPLIT([email], "@"), 2)
)

yes, the user could belong to more than one group
CORRECTION: the user can only below to one group

1 Like

Hi Steve, we’ll use the LOOKUP expression as you are correct, users belong to only one group.

@praveen the user will need to see all users for their group

I think I can use USERSETTINGS to capture the group the user is associated and then call on USERSETTINGS (group) as needed. I’ll update the note if successful.

UPDATE: USERSETTINGS() doesn’t work - seems to be a circular reference issue.

Thanks

1 Like

So where do we stand now?