Class Role
java.lang.Object
com.michelin.cio.hudson.plugins.rolestrategy.Role
- All Implemented Interfaces:
Comparable
Class representing a role, which holds a set of
Permissions.- Author:
- Thomas Maurel
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompare role names.booleanGets the role description.getName()Getter for the role name.Getter for the regexp pattern.Getter for thePermissions set.hasAnyPermission(Set<Permission> permissions) Checks if the role holds any of the givenPermission.inthashCode()hasPermission(Permission permission) Checks if the role holds the givenPermission.voidrefreshPermissionsFromTemplate(PermissionTemplate permissionTemplate) Updates the permissions from the given template.voidrefreshPermissionsFromTemplate(Collection<PermissionTemplate> permissionTemplates) Deprecated.voidsetTemplateName(String templateName)
-
Field Details
-
GLOBAL_ROLE_PATTERN
- See Also:
-
-
Constructor Details
-
Role
-
Role
-
Role
public Role(String name, Pattern pattern, Set<Permission> permissions, @CheckForNull String description) Create a Role.- Parameters:
name- The role namepattern- The pattern matchingAccessControlledobjects namespermissions- ThePermissions associated to the role.nullpermissions will be ignored.description- A description for the role
-
Role
public Role(String name, Pattern pattern, Set<Permission> permissions, @CheckForNull String description, String templateName) Create a Role.- Parameters:
name- The role namepattern- The pattern matchingAccessControlledobjects namespermissions- ThePermissions associated to the role.nullpermissions will be ignored.description- A description for the roletemplateName- True to mark this role as generated
-
-
Method Details
-
setTemplateName
-
getTemplateName
-
getName
Getter for the role name.- Returns:
- The role name
-
getPattern
Getter for the regexp pattern.- Returns:
- The pattern associated to the role
-
getPermissions
Getter for thePermissions set.- Returns:
Permissions set
-
refreshPermissionsFromTemplate
@Deprecated public void refreshPermissionsFromTemplate(Collection<PermissionTemplate> permissionTemplates) Deprecated.Updates the permissions from the template matching the name.- Parameters:
permissionTemplates- List of templates to look for
-
refreshPermissionsFromTemplate
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public void refreshPermissionsFromTemplate(@CheckForNull PermissionTemplate permissionTemplate) Updates the permissions from the given template. The name of the given template must match the configured template name in the role.- Parameters:
permissionTemplate- PermissionTemplate
-
getDescription
Gets the role description.- Returns:
- Role description.
nullif not set
-
hasPermission
Checks if the role holds the givenPermission.- Parameters:
permission- The permission you want to check- Returns:
- True if the role holds this permission
-
hasAnyPermission
Checks if the role holds any of the givenPermission.- Parameters:
permissions- APermissions set- Returns:
- True if the role holds any of the given
Permissions
-
compareTo
Compare role names. Used to sort the sets. We presume that any role name is being used once and only once.- Specified by:
compareToin interfaceComparable- Parameters:
o- The object you want to compare this instance to- Returns:
- Comparison of role names
-
hashCode
public int hashCode() -
equals
-
refreshPermissionsFromTemplate(PermissionTemplate)