--- title: "system.security.getUserRoles" description: "Fetches the roles for a user from the Gateway." --- # system.security.getUserRoles > Fetches the roles for a user from the Gateway. This function is used in **Python Scripting**. ## Description 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 User Source name is omitted as the authentication profile identifier, then the current project's default User Source is used. ## Client Permission Restrictions This scripting function has no [Client Permission](../../../ignition-modules/vision/vision-project-properties/vision-project-properties.md#vision-permissions-properties) restrictions. ## Syntax - Vision `system.security.getUserRoles(username, password, [authProfile], [timeout])` ### Parameters |Type | Parameter | Description| |------- | ------- | ------| |String| `username` | The username to fetch roles for.| |String| `password` | The password for the user.| |String| `authProfile` | The name of the authentication profile (User Source) to run against. Optional. Leaving this out will use the project's default profile. [optional]| |Integer| `timeout` | Timeout for client-to-gateway communication. Default is 60,000ms. [optional]| ### Returns **Tuple** - A list of the roles that this user has, if the user authenticates successfully. Otherwise, returns None. ### Scope Vision Client ## Syntax - Gateway and Perspective `system.security.getUserRoles(username, password, [authProfile])` ### Parameters |Type | Parameter | Description |------- | ------- | ------ |String| `username` | The username to fetch roles for.| |String| `password` | The password for the user.| |String| `authProfile` | The name of the authentication profile (User Source) 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 ## Code Examples ```python title="Example #1" # 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. ```