Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

Fetches the roles for a user from the Gateway. This may not be the currently logged in user. Requires the password for that user. If the authentication profile name is omitted, then the current project's default authentication profile is used.

Client permissions restrictions


Panel
titleSyntax

system.security.getUserRoles(username, password, [authProfile], [timeout])

  • Parameters

String username - The username to fetch roles for.

String password - The password for the user.

String authProfile - The name of the authentication profile to run against. Leaving this out will use the project's default profile. [optional]

Integer timeout - Timeout for Client-to-Gateway communication. Default: 60,000ms.  [optional]

  • Returns

Tuple - A list of the roles that this user has, if the user authenticates successfully. Otherwise, returns None.

  • Scope

Perspective Session, Vision Client

Panel
titleSyntax

system.security.getUserRoles(username, password, [authProfile])

  • Parameters

String username - The username to fetch roles for.

String password - The password for the user.

String authProfile - The name of the authentication profile to run against. Leaving this out will use the project's default profile. [optional]

  • Returns

Tuple - A list of the roles that this user has, if the user authenticates successfully. Otherwise, returns None.

  • Scope

Gateway, Perspective Session

Panel
titleCode Examples
Code Block
languagepy
titleCode Snippet
# Fetch the roles for a given user, and check to see if the role "Admin" is in them.

reqRole = "Admin"
username = "Billy"
password= "Secret"
roles = system.security.getUserRoles(username, password)
if reqRole in roles:
   # do something requiring "Admin" role.
Panel
titleKeywords

system security getuserRoles, security.getuserRoles