Show / Hide object base on User Role

Is it possible to hide / show object base on user role,
for example if the user has a role of “Operator” object shown otherwise object hidden.

yes, within the source code I change the visibility variable.
the command "
\SecurityManager\GetUserName()" returns the username

then I make a condition, if the username is authorized to see

this guide is very good
https://www.vtscada.com/wp-content/uploads/2016/09/VTScada11-2-ProgrammersGuide.pdf