Skip to main content

 

Reference

 

Applies only to Mobile Apps and Reactive Web Apps

 

OutSystems

Security

  • Edit
    Collaborate with us
    Edit this page on GitHub
  • 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:

    • roleKey: string
      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?