isUserInRole

All users in any Gebra Suite workspace shoyuld have been assigned a specific user role. isUserInRole takes a string argument role. On the basis of this role parameter, it determines whether a logged u

app.isUserInRole("Management");

Parameters

  1. role - It is a string parameter. It is the name of logged in user role which needs to be checked.

Example Usage

We have seen address app in the docs of ReadOnlyMode function. Now we will build upon that functionality. In it we have used readOnlyMode function to disable all app controls. Now we want that if user is of admin role then all the controls should be enabled and disabled otherwise. For this we need to update our custom code. It should look like this.

if (app.isUserInRole("Admin")) {
  app.readOnlyMode(false);
  console.log("raghib");
} else {
  app.readOnlyMode();
}

Now If user 'raghib' has an admin role assigned to him then address app will be enabled for him and for all other non admin users. It will be disabled.

Return Values

The function returns a boolean value, either true or false.

Last updated