How do I use a table of useremails to set certain tables to edit vs read only for everyone else

I have a table that has all employees and another table that list the directors and primary and backup liaisons.

I will be using our company domain to authenticate login access but want to limit who can update records based on this second table, so that only the director and primary/backup liaisons can update records for their department. Department is a field in both tables.

Iโ€™m really stuck on how to do this.

I know I can take the individual email addresses and list them in the Date > Table > are updates allowed section but I think there may be a better way.

Attached is a screenshot of the columns for the table I want to use for the security filters. They can see all employees regardless of department, but should only be able to update records for their department. Hope that makes sense.

Thanks
2X_c_c639bcb64f906b2a179a309e86c1f40fb5de9219.jpeg

0 10 570
10 REPLIES 10

@tcanelli
Just create a table for User Access Privileges including userโ€™s email, tablenames and ENUM values for the access levels. Than you can simply use a LOOKUP expression via Data > Table > Are updates allowed property i.e.

LOOKUP(
    USEREMAIL(),
    "UserAccessTable",
    "EmailColumn",
    "AccessRightsColumn"
)

I donโ€™t really understand. What would go in the โ€œaccessrightscolโ€? And how would this just limit them to edit their own department info?

Could something like this also be used?

OR(IN(USEREMAIL(), โ€œDept PMs (Liaisons to EM)โ€[Backup PM Emails]), USEREMAIL() = [Backup PM Emails])

Steve
Platinum 4
Platinum 4

There are several ways to approach this depending on how tight you want security. The most straight-forward way is to attach a condition to the tableโ€™s row edit action so that the row can only be edited by the appropriate users:

With an expression like this:

ISNOTBLANK(
  FILTER(
    "MyTable",
    AND(
      ([_THISROW].[Department] = [Department])
      IN(
        USEREMAIL(),
        LIST(
          [Director Email],
          [Primary PM Emails],
          [Backup PM Emails]
        )
      )
    )
  )
)

Note that if Primary PM Emails and Backup PM Emails are lists, the expression will need an adjustment.

2X_1_18ba2d128520e5709081714904c12ad12c96ebc7.jpeg

I get the attached error. I wasnโ€™t sure what your comment about the lists meant but that doesnโ€™t seem to be what the error is about???

@tcanelli
Unintentionally, @Steve had forgotten a comma within AND. Try with this:

ISNOTBLANK(
  FILTER(
    "MyTable",
    AND(
      ([_THISROW].[Department] = [Department]),
      IN(
        USEREMAIL(),
        LIST(
          [Director Email],
          [Primary PM Emails],
          [Backup PM Emails]
        )
      )
    )
  )
)

Thank you @Steve and @LeventK - this seems to work - I think. I donโ€™t see the edit button on records outside my department, but notice that fields I set for quick edit still allow for updates. Is this normal? Should I add the above expression in another place to prevent even the quick edit fields from being updating?

@tcanelli
You can use the same expression for the Editable_if or Show_if property of your Quick Edit columns I believe. If you prefer Show_if, then you need to set the global property to ON from UX > Options

Yes, that worked! Thank you!

Youโ€™re welcome, my pleasure to help.

Top Labels in this Space