Class PermissionTemplate
- java.lang.Object
-
- com.michelin.cio.hudson.plugins.rolestrategy.PermissionTemplate
-
- All Implemented Interfaces:
Comparable<PermissionTemplate>
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class PermissionTemplate extends Object implements Comparable<PermissionTemplate>
Holds a set of permissions for the role generator.
-
-
Constructor Summary
Constructors Constructor Description PermissionTemplate(String name, Set<String> permissions)
Create a new PermissionTemplate.PermissionTemplate(Set<Permission> permissions, String name)
Create a new PermissionTemplate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(PermissionTemplate o)
boolean
equals(Object obj)
String
getName()
Set<Permission>
getPermissions()
int
hashCode()
Boolean
hasPermission(Permission permission)
Checks if the role holds the givenPermission
.boolean
isUsed()
Checks whether the template is used by one or more roles.
-
-
-
Constructor Detail
-
PermissionTemplate
@DataBoundConstructor public PermissionTemplate(String name, Set<String> permissions)
Create a new PermissionTemplate.- Parameters:
name
- the name of the templatepermissions
- the set of permissions of this template
-
PermissionTemplate
public PermissionTemplate(Set<Permission> permissions, String name)
Create a new PermissionTemplate.- Parameters:
name
- the name of the templatepermissions
- the set of permissions of this template
-
-
Method Detail
-
isUsed
public boolean isUsed()
Checks whether the template is used by one or more roles.- Returns:
- true when template is used.
-
getName
public String getName()
-
getPermissions
public Set<Permission> getPermissions()
-
hasPermission
public Boolean hasPermission(Permission permission)
Checks if the role holds the givenPermission
.- Parameters:
permission
- The permission you want to check- Returns:
- True if the role holds this permission
-
compareTo
public int compareTo(@NonNull PermissionTemplate o)
- Specified by:
compareTo
in interfaceComparable<PermissionTemplate>
-
-