isUserInRole

All users in any Brixxbox 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 user

   brixxApi.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 ap controls. Now we want tht 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(brixxApi.isUserInRole("Admin")){
    brixxApi.readOnlyMode(false);
    console.log("raghib")
}
else{
    brixxApi.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.

Last updated