User Permissions with actions

Hi all,

I have two actions that are used to send notifications to buyers i.e. an action that triggers a workflow rule. I had it in mind that one specific type of user would be clicking the action button (the site admin), however the process has changed and it is now necessary for site admin AND buyers to send this notification.

However, site admin cannot do so after 2pm everyday. Looking to find the right expression to block site admin from sending the notification after 2pm but keeping the action accessible for buyers at all times throughout the day. I have attempted to do this using USERROLE() expression, like so

โ€œAND(TIMENOW()<= โ€œ14:00:00โ€,USERROLE()=โ€œSite Adminโ€,OR(USERROLE()=โ€œBuyerโ€))โ€

Anytime I have tried to filter out certain user permissions I have had to use the USEREMAIL() expression to target specific users because USERROLE() was not effective. So possibly looking into alternatives or an expression that allows USEREMAIL() rather than ROLE(); keeping in mind there may be up to 9 users under each role.

Thanks

Solved Solved
0 3 1,845
1 ACCEPTED SOLUTION

Hey Sarah.

Unfortunately, USERROLE() only has two options:
2X_2_289327e74fdfaeb4a5e2cfe7c820fe2406d10258.png
What Iโ€™ve done in the past for things like this is to create my own user role system by use of a Users table, with a User_Role column, and a Current_User slice.

By creating a Current_user slice, with a formula of [User_Login_Email] = USEREMAIL(), we can isolate out that specific userโ€™s record from the User table.

Then we can easily grab the role for the user: ANY(Current_User[User_Role])

By creating a system this way you can completely customize the roles that your app uses, instead of being limited to Admin and User. Often times I create three layers: Dev, Admin, User.


(Assuming you implement a Current_User slice system from above)

or(
  ANY(Current_User[User_Role]) = "Buyer", 
  and(
    ANY(Current_User[User_Role]) = "Site Admin", 
    TIMENOW()<= โ€œ14:00:00โ€
  )
)

View solution in original post

3 REPLIES 3

Hey Sarah.

Unfortunately, USERROLE() only has two options:
2X_2_289327e74fdfaeb4a5e2cfe7c820fe2406d10258.png
What Iโ€™ve done in the past for things like this is to create my own user role system by use of a Users table, with a User_Role column, and a Current_User slice.

By creating a Current_user slice, with a formula of [User_Login_Email] = USEREMAIL(), we can isolate out that specific userโ€™s record from the User table.

Then we can easily grab the role for the user: ANY(Current_User[User_Role])

By creating a system this way you can completely customize the roles that your app uses, instead of being limited to Admin and User. Often times I create three layers: Dev, Admin, User.


(Assuming you implement a Current_User slice system from above)

or(
  ANY(Current_User[User_Role]) = "Buyer", 
  and(
    ANY(Current_User[User_Role]) = "Site Admin", 
    TIMENOW()<= โ€œ14:00:00โ€
  )
)

By โ€˜sliceโ€™ are you referring to a column slice or an additional column in the user table. My user table has a user email and user role column as of right now.

You already have the role column, awesome! I mean to create a slice, as in Data>Slices
2X_d_d11a9abc069cee6a156217be29a36b71a3687e60.gif

Top Labels in this Space