hasRole
  • 30 Oct 2020
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

hasRole

  • Dark
    Light
  • PDF

Article summary

Description

Type: Boolean

Returns whether or not the user belongs to a specified security role.


Examples

// take action if user belongs to a specific role
if (user.hasRole("prep"))
    debug.log("User belongs to the prep role!");
// display if the user has the 'prep' role
debug.log(user.hasRole("prep"));

Remarks

Definition

A role is a security term that refers to a type of user and the set of permissions they have.

IT administrators assign roles to users (according to their job specifications) when the user's account is first set up or when management requests changes. These roles often dictate which product features a user can access.

For example, a Dr. Know user could be a technician using your app to collect certain data elements during patient testing. Later, a physician might use your app to review this information and complete a report. Each user would belong to a distinct role. Users can also belong to more than one role.

You can use this information within your scripts to deliver role-specific features and user experience enhancements.


What's Next