Package ca.cdr.api.security.permission
Class RoleName
java.lang.Object
ca.cdr.api.security.permission.PermissionArgumentValue
ca.cdr.api.security.permission.RoleName
- All Implemented Interfaces:
PermissionArgumentFormat.IPermissionComponent,PermissionArgumentFormat.IRoleNameRestriction
public final class RoleName
extends PermissionArgumentValue
implements PermissionArgumentFormat.IRoleNameRestriction
A role name.
Accepts only uppercase letters and single underscores between letters.
-
Method Summary
Modifier and TypeMethodDescriptionthe name of a rolestatic booleanisValidRoleName(String theRoleName) Validates that a role name contains only uppercase letters and single underscores between letters.static voidvalidateRoleName(String theRoleName, String theRoleType) Validates that a role name contains only uppercase letters and single underscores between letters.Methods inherited from class ca.cdr.api.security.permission.PermissionArgumentValue
toString
-
Method Details
-
isValidRoleName
Validates that a role name contains only uppercase letters and single underscores between letters.Valid examples:
MDM_UI_DATA_STEWARD,MY_ROLE,AInvalid examples:
myRole(lowercase),ROLE__SALES(consecutive underscores),_ADMIN(leading underscore),ADMIN_(trailing underscore),ROLE123(numbers),ROLE-ADMIN(special characters)- Parameters:
theRoleName- the role name to validate- Returns:
- true if the role name is valid, false otherwise
-
validateRoleName
Validates that a role name contains only uppercase letters and single underscores between letters. Throws an exception if the role name is invalid.- Parameters:
theRoleName- the role name to validatetheRoleType- the type of role (e.g., "APP_ROLE", "CUSTOM_ROLE") for error messages- Throws:
IllegalArgumentException- if the role name is invalid
-
getRoleName
Description copied from interface:PermissionArgumentFormat.IRoleNameRestrictionthe name of a role- Specified by:
getRoleNamein interfacePermissionArgumentFormat.IRoleNameRestriction
-