Assign a condition in a string tag and use in an expresion tag

Hi everyone, I’m Paco Armengol, I’m from Spain.
I want to ask a question to the Inductive automation community.
I want to make a button visible or not based on the user’s role. So far correct, but when there are many roles and buttons it becomes difficult to maintain it.
I had thought about the condition Ejem…“”“”" (if(hasRole(“quality”) || hasRole(“Administrator”) || hasRole(“Supervisor”)|| hasRole(“Director@”)|| hasRole(“DevelopmentProduct”)), true, false) )“”“”“”", put it in a tag and then from the visible property of the buttons call this tag. In this way, if I want to add a new role, I only have to do it in one place, in the tag that will contain the string with the condition.
Does anyone know how to do it?

Thank you very much

Hi Paco, and welcome!

I think you just answered your own question, but we can simplify it a little. :slight_smile: The following expression will return true / false without needing the ‘if’ statement.

 || hasRole('Administrator')
 || hasRole('Supervisor')
 || hasRole('Director@') 
 || hasRole('DevelopmentProduct')

Alternatively, you can also set security on individual components.

No, you cannot compile expressions at runtime.