Skip to main content

Reference

 

Applies only to Mobile Apps
OutSystems

Security

Provides methods for doing client side role checks. Used to programmatically show or hide UI elements depending on a given role.

Summary

Functions
checkIfCurrentUserHasRole Checks if the current user has the given role.

Functions

checkIfCurrentUserHasRole

checkIfCurrentUserHasRole(roleKey: string): boolean

Checks if the current user has the given role.

Tip: module roles are available through the $roles pre-defined object.

Example:

// check if the current user has the 'MyAppManager' role
$parameters.IsManager = $public.Security.checkIfCurrentUserHasRole($roles.MyAppManager);

Parameters

  • roleKeystring

    Object with role information, accessible in JavaScript code using $roles.<RoleName>.

Returns

  • boolean

Returns true if the current user has the given role, false otherwise.

  • Was this article helpful?