Assigned users in User Management can't access the Client

I have assigned 3 users in User, Roles section in gateway webpage under default profile. Have assigned the same in Designer’s Project Properties. But when I run my client, it logs in but fails to open the dedicated mimics that I gave the users access to. The button on which their access is granted shows disabled & few other buttons don’t even show up in the Client. What’s wrong here? :worried:


On 1 of the buttons I have the foll script;-

Change your if to

if 'Administrator' or 'Manager' or 'Operator' in roles:

Then on the Enabled property for the other buttons, use the hasRole expression function to enable or disable the button.

1 Like

do what he said he is right. I concur

The code above will not work as expected, it will evaluate as

if 'Administrator' or 'Manager' or ('Operator' in roles):

Which means that it will always pass as the string "Administrator" is a truthy value (any non-empty string is evaluated to True when cast to a boolean).

Just try this if you like:

myList = ["A","B","C"]
if "D" or "E" in myList:
    print "D or E in myList"
    
if "D" in myList or "E" in myList:
    print "D in myList or E in myList"

You will see that the first passes, even though there's no "D" nor "E" in the list, but the second test does not pass, which is correct.

So there's nothing wrong with that piece of code from the OP, the problem has to be elsewhere. Probably not with the script, but with the security bindings (right-click on a component > security).

1 Like

I see what you mean I think what he meant was remove the u. I was just browsing and not looking to close. oops

hii you can try this it will work

role = [‘Administrator’,‘Manager’,‘Operator’]
is_role = False

for i in role:
if i in system.security.getRoles():
window = system.nav.swapTo(‘Window 1’)
system.nav.centerWindow(window)
is_role = True

if is_role == False:
system.gui.messageBox(‘Insufficient security privileges.’)