This documentation is for WSO2 Identity Server 5.7.0 . View documentation for the latest release.

All docs This doc

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This function assigns each of the roles specified in the ‘ assigningRoles ’ parameter to the specified ‘ user ’ object. It returns true if all the roles are successfully assigned and returns false if not.  It includes the following parameters.  For implementation details, see the code repository.

ParameterDescription
userAn object representing the user details.
assigningRolesA list of strings containing roles that are to be assigned where each string is a role name.
Code Block
executeStep(1, {
    onSuccess: function (context) {
        // Extracting authenticated subject from the first step.
        let user = context.currentKnownSubject;
        assignUserRoles(user, ['exampleRole1', 'exampleRole2']);
    }
});
removeUserRoles(user, removingRoles)

This function removes each of the roles specified in the ‘ removingRoles ’ parameter to the given ‘ user ’ object. It returns true if all the roles are successfully removed and returns false if not. It includes the following parameters. For more implementation details, see the code repository.

ParameterDescription
userAn object representing the user details.
removingRolesA list of strings that containing roles that are to be removed where each string is a role name.
Code Block
executeStep(1, {
    onSuccess: function (context) {
        // Extracting authenticated subject from the first step.
        let user = context.currentKnownSubject;
        removeUserRoles(user, ['exampleRole1', 'exampleRole2']);
    }
});


...