USERROLE()="Admin" in the security filter does not work with the BOTs?

 

OR((USEREMAIL() = [Email]), (USERROLE() = "Admin"))

A security filter on the above pattern does not seem to be working as shown by my testing. The automation bot does not update records with this security filter.

However when I code the security filter in the following format, meaning by hardcoding the email of the user with the with the "Admin" user role, the automation works.

OR((USEREMAIL() = [Attendee_Email]),USEREMAIL()="abcde@gmail.com")

where "abcde@gmail.com" is the email of the user with role defined as USERROLE()

May I know if anybody else experiences this or am I missing something?

In both the cases, in the automation event, I have enabled the "bypass security filter" setting.

The article below does mention use of USERROLE() in security filters.

Suvrutt_Gurjar_0-1681901173836.png

 

 

 

 

0 5 382
5 REPLIES 5

So a process in a bot is run without any credentials.  So UserEmail() and UserRole() will return blank or not work as you'd expect.  To get around this in security filters you need to use CONTEXT("Host")="Server" which is TRUE if its running in a bot.

https://support.google.com/appsheet/answer/10107885?hl=en&sjid=4210925681345893179-EU

Simon, 1minManager.com

hi @1minManager ,

Thank you very much for your response. I have essentially already bypassed the security filters by the following settings in the events pane when running the bot.

Suvrutt_Gurjar_0-1681905128397.png

Yet, it runs with USEREMAIL() but not with USERROLE() in the security filter. I believe once bypassed, security filter settings should be practically ineffective?

 

 


@Suvrutt_Gurjar wrote:

I believe once bypassed, security filter settings should be practically ineffective?

 


Is it the security filter, or is it the start condition for the bot not triggering.  Have you checked the automation monitor?

 

Yes, it is the security filter. Bot runs by properly updating the rows when the security filter contains USEREMAIL() in the expression. However the bot does not run when the security filter contains USERROLE().

The log analyzer shows an error of the pattern "row having key "abcd1234" not found. This error occurs only with USERROLE() in the security filter. The bot runs smoothly when USERROLE() is removed from the security filter expression.

The help article says this error occurs due to security filter , filtering out the rows. But as mentioned before, security filter is already bypassed in the bot's event setting.

Suvrutt_Gurjar_0-1681908500166.png

Troubleshoot API Calls - AppSheet Help

 

Try amending your security filter to include

IFS(
CONTEXT("Host")="Server",TRUE,
<...rest of your formula...>
)

 Just to test out the theory that this is a bug somewhere in security filters.

I think both these 2

OR((USEREMAIL() = [Email]), (USERROLE() = "Admin"))
OR((USEREMAIL() = [Attendee_Email]),USEREMAIL()="abcde@gmail.com")

should both return FALSE when being run as a bot since both UserEmail() and UserRole() should be "".  So its a bit odd that changing it to USEREMAIL()="abcde@gmail.com" actually makes a difference.

Does setting the Blank Values to Legacy or Consistent make any difference?

Top Labels in this Space