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 Details

    • PermissionTemplate

      @DataBoundConstructor public PermissionTemplate(String name, Set<String> permissions)
      Create a new PermissionTemplate.
      Parameters:
      name - the name of the template
      permissions - 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 template
      permissions - the set of permissions of this template
  • Method Details

    • 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 given Permission.
      Parameters:
      permission - The permission you want to check
      Returns:
      True if the role holds this permission
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(@NonNull PermissionTemplate o)
      Specified by:
      compareTo in interface Comparable<PermissionTemplate>