checkIfUserIsAssignedToResource

The checkIfUserIsAssignedToResource() method is designed to verify whether a user is currently assigned to a given resource with a specified role and user type.

Arguments

This method requires an object with the following parameters:
  • userID: The identifier of the user in question.
  • roleID: The identifier of the role to check against the user.
  • resource: The identifier of the resource to check for user assignment.
  • userType: Checks for a specific user type.

Returns

The method returns a Boolean value:
  • true if the user is currently assigned to the resource with the given role.
  • false otherwise.

Usage Example

const isAssigned = await this.checkIfUserIsAssignedToResource({
  userID: someUserId,
  roleID: someRoleId,
  resource: someResourceId,
  userType: UserType.USER,
});
In this example, checkIfUserIsAssignedToResource() is used to determine whether a specific user (identified by someUserId) is assigned a specific role (identified by someRoleId) for a particular resource (identified by someResourceId).