Filtering data and views based on user roles/classes

As of now I filter data and views by straight away putting useremail() directly in the show_if or other contingent fields. Like show if useremail()=“abc@xyz.com

Which will be a problem when the users increase.

For that I have assigned each user a user role (there are four roles as of now, with prospects to diversify in the future), and I wish to filter data and views based on that role, rather than using useremail() directly.

So, is there a way to do that by using class-emails like admins@xyz.com, moderators@xyz.com ? Maybe I have seen something like that.

Or do I have to bring up the ‘role’ value for each user for achieving that? If so, then I guess that I have to use dereferences after making a virtual column in every sheet that records the useremail and dereferencing that role corresponding to user-email in the employee page.

Am I on the right track, or far from it?

Best to have a table that describes your users, including their email address and roles. Then in your Show_If expressions, you could do something like:

ISNOTBLANK(
  FILTER(
    "Users",
    AND(
      (USEREMAIL() = [Email]),
      IN("ExpertUser", [Roles])
    )
  )
)

@Steve I’m doing something similar but can’t get it to work.

Users table with User_NO as key. USER_EMAIL and Key_Prayer are fields I need to evaluate.

On a Show_IF for a UX.Form based on a slice from the Requests table, I only want the logged in user
USEREMAIL() to see the form if their record USERS.Key_Prayer =TRUE

I’ve tried numerous expressions but they all fail to limit it to the condition I want to use, list above.

Do you, or anyone else, need more info to help me? Thanks.

@Lucinda_Mason, I’m not clear on exactly what you’re trying to accomplish.

The Show If expression of a view in a non-ref position determines whether the view is shown or hidden in its designated position. Show If has no effect on views in the ref position.

Can you explain further what you’re trying to do?

In a form’s Show_If: Something like this: IF(LOOKUP(USEREMAIL(), “Users”, “USER_EMAIL”, "KEY_PRAYER”)=TRUE,TRUE,FALSE)

When, if the current user’s record in the Users table (matched via email) has the column Key_Prayer = True. Then the form can show. If Key_Prayer=False, then the form won’t show.

Where would you expect the form to show?

I have a deck view that serves as a menu. I don’t want the link to appear here, yes that is probably one of the issues.

The top one should only appear when the conditions I listed earlier are True. I’m really confused now, so I totallly understand if I am making NO sense. :joy:
Screen Shot 2020-06-27 at 4.33.38 PM

Ok @Steve, you got me in the right direction.

I used:
LOOKUP(USEREMAIL(), “Users”, “USER_EMAIL”, "KEY_PRAYER”)=TRUE
in the row filter condition for the menu slice that pulls the data to appear on the table view.

Now, I just have to incorporate it into the existing Row Filter I was using:

IF(ISBLANK(LOOKUP(USEREMAIL(), “Users”, “USER_EMAIL”, "PI_NO”)),
IN(99,[PI_NO]),
OR(IN(LOOKUP(USEREMAIL(), “Users”, “USER_EMAIL”, "PI_NO”),[PI_NO])
,IN(0,[PI_NO])))