I need to check if a user is allowed to edit a field of each row. Now to manage who can edit a row, we put Google Groups and e-mails into a EnumList field called “Editor”.
Now if his e-email is in there it is straight forward, but how can I check if he is part of that google group?
One idea was to give each group a specific name and check the USERROLE(). But that does not seem to work with custom app roles besides User and Admin.
Maybe a silly question but.. if the user doesn’t exist in your list, wouldn’t it mean the rest of them belong to Google Group as they have the access to use the app?
If it does not work as expected, I would suggest to contact support and ask them to have a look to it.
Just out of curiosity, what do you get when displaying USERROLE() for a user belonging to the group you are showing? Last time I checked I got the correct custom role.
However, please note that today, the group-picking system works if the user does not belong to more than 100 groups simultaneously. Depending on your domain architecture, you may have a difficulty into picking it.
You are right. That works. For me the “Preview as” feature was the issue. It did not display the correct userrole() when switching between user from different groups. I tested it with a “real person” and he saw the custom app roles that I defined.
Now I just have to figure out how to handle if they are in multiple groups, since userrole() can only be one value and it will use the first match from the hierarchy that is defined in the settings if I am not mistaking.
Thanks for the heads-up with the 100 group limit, did not know about that one.