com.michelin.cio.hudson.plugins.rolestrategy
Class RoleMap

java.lang.Object
  extended by com.michelin.cio.hudson.plugins.rolestrategy.RoleMap

public class RoleMap
extends java.lang.Object

Class holding a map for each kind of AccessControlled object, associating each Role with the concerned Users/groups.

Author:
Thomas Maurel

Method Summary
 void addRole(Role role)
          Add the given role to this RoleMap.
 void assignRole(Role role, java.lang.String sid)
          Assign the sid to the given Role.
 void clearSids()
          Clear all the sids for each Role of the RoleMap.
 void clearSidsForRole(Role role)
          Clear all the sids associated to the given Role.
 hudson.security.SidACL getACL()
          Get the ACL for the current RoleMap.
 java.util.SortedMap<Role,java.util.Set<java.lang.String>> getGrantedRoles()
          Get an unmodifiable sorted map containing Roles and their assigned sids.
 Role getRole(java.lang.String name)
          Get the Role object named after the given param.
 java.util.Set<Role> getRoles()
          Get an unmodifiable set containing all the Roles of this RoleMap.
 java.util.SortedSet<java.lang.String> getSids()
          Get all the sids referenced in this RoleMap, minus the Anonymous sid.
 java.util.SortedSet<java.lang.String> getSids(java.lang.Boolean includeAnonymous)
          Get all the sids referenced in this RoleMap.
 java.util.Set<java.lang.String> getSidsForRole(java.lang.String roleName)
          Get all the sids assigned to the Role named after the roleName param.
 boolean hasRole(Role role)
          Check if the RoleMap contains the given Role.
 RoleMap newMatchingRoleMap(java.lang.String namePattern)
          Create a sub-map of the current RoleMap containing only the Roles matching the given pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

hasRole

public boolean hasRole(Role role)
Check if the RoleMap contains the given Role.

Returns:
True if the RoleMap contains the given role

getACL

public hudson.security.SidACL getACL()
Get the ACL for the current RoleMap.

Returns:
ACL for the current RoleMap

addRole

public void addRole(Role role)
Add the given role to this RoleMap.

Parameters:
role - The Role to add

assignRole

public void assignRole(Role role,
                       java.lang.String sid)
Assign the sid to the given Role.

Parameters:
role - The Role to assign the sid to
sid - The sid to assign

clearSidsForRole

public void clearSidsForRole(Role role)
Clear all the sids associated to the given Role.

Parameters:
role - The Role for which you want to clear the sids

clearSids

public void clearSids()
Clear all the sids for each Role of the RoleMap.


getRole

public Role getRole(java.lang.String name)
Get the Role object named after the given param.

Parameters:
name - The name of the Role
Returns:
The Role named after the given param

getGrantedRoles

public java.util.SortedMap<Role,java.util.Set<java.lang.String>> getGrantedRoles()
Get an unmodifiable sorted map containing Roles and their assigned sids.

Returns:
An unmodifiable sorted map containing the Roles and their associated sids

getRoles

public java.util.Set<Role> getRoles()
Get an unmodifiable set containing all the Roles of this RoleMap.

Returns:
An unmodifiable set containing the Roles

getSids

public java.util.SortedSet<java.lang.String> getSids()
Get all the sids referenced in this RoleMap, minus the Anonymous sid.

Returns:
A sorted set containing all the sids, minus the Anonymous sid

getSids

public java.util.SortedSet<java.lang.String> getSids(java.lang.Boolean includeAnonymous)
Get all the sids referenced in this RoleMap.

Parameters:
includeAnonymous - True if you want the Anonymous sid to be included in the set
Returns:
A sorted set containing all the sids

getSidsForRole

public java.util.Set<java.lang.String> getSidsForRole(java.lang.String roleName)
Get all the sids assigned to the Role named after the roleName param.

Parameters:
roleName - The name of the role
Returns:
A sorted set containing all the sids

newMatchingRoleMap

public RoleMap newMatchingRoleMap(java.lang.String namePattern)
Create a sub-map of the current RoleMap containing only the Roles matching the given pattern.

Parameters:
namePattern - The pattern to match
Returns:
A RoleMap containing only Roles matching the given name


Copyright © 2010. All Rights Reserved.