org.apache.jetspeed.security
Interface RoleManager

All Superinterfaces:
PrincipalTypeManager, java.io.Serializable

public interface RoleManager
extends PrincipalTypeManager

Describes the service interface for managing roles.

Version:
$Id: RoleManager.java 702099 2008-10-06 11:13:38Z ate $

Method Summary
 Role addRole(java.lang.String roleName)
           Add a new role
 Role addRole(java.lang.String roleName, boolean mapped)
           Add a new role and optionally map/replicate it to an external storage manager (if configured).
 void addRoleToGroup(java.lang.String roleName, java.lang.String groupName)
          Add a role to a group.
 void addRoleToRole(Role from, Role to, java.lang.String associationName)
          Add a hierarchical association between two roles.
 void addRoleToUser(java.lang.String username, java.lang.String roleName)
          Add a role to a user.
 Role getRole(java.lang.String roleName)
          Get a role Role for a given role name.
 java.util.List<java.lang.String> getRoleNames(java.lang.String nameFilter)
           Retrieves a detached and modifiable List of role names, finding roles matching the corresponding role name filter.
 java.util.List<Role> getRoles(java.lang.String nameFilter)
          Retrieves a detached and modifiable Role list matching the corresponding role name filter.
 java.util.List<Role> getRolesAssociatedFrom(Role from, java.lang.String associationName)
          Retrieve all the roles which are associated from the provided role.
 java.util.List<Role> getRolesAssociatedTo(Role to, java.lang.String associationName)
          Retrieve all the roles which are associated to the provided role.
 java.util.List<Role> getRolesForUser(java.lang.String username)
          Retrieves a detached and modifiable Role list of all the roles associated to a specific user.
 java.util.List<Role> getRolesInGroup(java.lang.String groupName)
          Retrieves a detached and modifiable Role list of all the roles associated to a specific group.
 boolean isGroupInRole(java.lang.String groupName, java.lang.String roleName)
          Whether or not a role is in a group.
 boolean isUserInRole(java.lang.String username, java.lang.String roleName)
          Whether or not a user is in a role.
 Role newRole(java.lang.String name, boolean mapped)
           
 Role newTransientRole(java.lang.String name)
           
 void removeRole(java.lang.String roleName)
          Remove a given role
 void removeRoleFromGroup(java.lang.String roleName, java.lang.String groupName)
          Remove a role from a group.
 void removeRoleFromRole(Role from, Role to, java.lang.String associationName)
          Remove a hierarchical association between two roles.
 void removeRoleFromUser(java.lang.String username, java.lang.String roleName)
          Remove a user from a role.
 boolean roleExists(java.lang.String roleName)
          Whether or not a role exists.
 void updateRole(Role role)
          Updates a role and all its attributes
 
Methods inherited from interface org.apache.jetspeed.security.PrincipalTypeManager
getPrincipalManager, getPrincipalType
 

Method Detail

newRole

Role newRole(java.lang.String name,
             boolean mapped)

newTransientRole

Role newTransientRole(java.lang.String name)

addRole

Role addRole(java.lang.String roleName)
             throws SecurityException

Add a new role

If an external security storage manager is used, the role will be mapped/replicated to it as well.

Parameters:
roleName - The role name
Returns:
the new Role
Throws:
Throws - a security exception if the role already exists.
SecurityException

addRole

Role addRole(java.lang.String roleName,
             boolean mapped)
             throws SecurityException

Add a new role and optionally map/replicate it to an external storage manager (if configured).

Parameters:
roleName - The role name.
mapped - if the new Role should be mapped/replicated to an external security storage manager (if used) or not.
Returns:
the new Role
Throws:
Throws - a security exception if the role already exists.
SecurityException

removeRole

void removeRole(java.lang.String roleName)
                throws SecurityException

Remove a given role

Parameters:
roleName -
Throws:
Throws - a security exception.
SecurityException

roleExists

boolean roleExists(java.lang.String roleName)

Whether or not a role exists.

Parameters:
roleName -
Returns:
Whether or not a role exists.

getRole

Role getRole(java.lang.String roleName)
             throws SecurityException

Get a role Role for a given role name.

Parameters:
roleName - The role name
Returns:
The Role.
Throws:
Throws - a security exception if the role does not exist.
SecurityException

getRolesForUser

java.util.List<Role> getRolesForUser(java.lang.String username)
                                     throws SecurityException

Retrieves a detached and modifiable Role list of all the roles associated to a specific user.

Parameters:
username - The user name.
Returns:
A List of Role.
Throws:
Throws - a security exception if the user does not exist.
SecurityException

getRolesInGroup

java.util.List<Role> getRolesInGroup(java.lang.String groupName)
                                     throws SecurityException

Retrieves a detached and modifiable Role list of all the roles associated to a specific group.

Parameters:
groupName - The group name
Returns:
A Collection of Role.
Throws:
Throws - a security exception if the group does not exist.
SecurityException

addRoleToUser

void addRoleToUser(java.lang.String username,
                   java.lang.String roleName)
                   throws SecurityException

Add a role to a user.

Parameters:
username - The user name
roleName - The role name
Throws:
Throws - a security exception if the role or the user do not exist.
SecurityException

removeRoleFromUser

void removeRoleFromUser(java.lang.String username,
                        java.lang.String roleName)
                        throws SecurityException

Remove a user from a role.

Parameters:
username - The user name.
roleName - The role name
Throws:
Throws - a security exception.
SecurityException

isUserInRole

boolean isUserInRole(java.lang.String username,
                     java.lang.String roleName)
                     throws SecurityException

Whether or not a user is in a role.

Parameters:
username - The user name.
roleName - The role name
Returns:
Whether or not a user is in a role.
Throws:
Throws - a security exception if the role or the user does not exist.
SecurityException

addRoleToGroup

void addRoleToGroup(java.lang.String roleName,
                    java.lang.String groupName)
                    throws SecurityException

Add a role to a group.

Parameters:
roleName - The role name
groupName - The group name
Throws:
Throws - a security exception.
SecurityException

removeRoleFromGroup

void removeRoleFromGroup(java.lang.String roleName,
                         java.lang.String groupName)
                         throws SecurityException

Remove a role from a group.

Parameters:
roleName - The role name
groupName - The group name
Throws:
Throws - a security exception.
SecurityException

isGroupInRole

boolean isGroupInRole(java.lang.String groupName,
                      java.lang.String roleName)
                      throws SecurityException

Whether or not a role is in a group.

Parameters:
groupName - The group name
roleName - The role name
Returns:
Whether or not a role is in a group.
Throws:
Throws - a security exception if the role or the group does not exist.
SecurityException

getRoles

java.util.List<Role> getRoles(java.lang.String nameFilter)
                              throws SecurityException
Retrieves a detached and modifiable Role list matching the corresponding role name filter.

Parameters:
nameFilter - The filter used to retrieve matching roles.
Returns:
a list of Role
Throws:
SecurityException

getRoleNames

java.util.List<java.lang.String> getRoleNames(java.lang.String nameFilter)
                                              throws SecurityException

Retrieves a detached and modifiable List of role names, finding roles matching the corresponding role name filter.

Parameters:
nameFilter - The filter used to retrieve matching roles.
Returns:
A list of role names
Throws:
SecurityException

updateRole

void updateRole(Role role)
                throws SecurityException
Updates a role and all its attributes

Parameters:
role -
Throws:
SecurityException

addRoleToRole

void addRoleToRole(Role from,
                   Role to,
                   java.lang.String associationName)
                   throws SecurityException
Add a hierarchical association between two roles.

Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A and JetspeedPrincipalAssociationType.IS_PART_OF, but it will depend on the actual runtime configuration if the required JetspeedPrincipalAssociationType is available.

Parameters:
from - The role for the from side of the association
to - The role for the to side of the association
associationName - The name of the JetspeedAssociationType to create
Throws:
SecurityException

removeRoleFromRole

void removeRoleFromRole(Role from,
                        Role to,
                        java.lang.String associationName)
                        throws SecurityException
Remove a hierarchical association between two roles.

Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A and JetspeedPrincipalAssociationType.IS_PART_OF, but it will depend on the actual runtime configuration if the required JetspeedPrincipalAssociationType is available.

Parameters:
from - The role for the from side of the association
to - The role for the to side of the association
associationName - The name of the JetspeedAssociationType to create
Throws:
SecurityException

getRolesAssociatedTo

java.util.List<Role> getRolesAssociatedTo(Role to,
                                          java.lang.String associationName)
Retrieve all the roles which are associated to the provided role.

Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A and JetspeedPrincipalAssociationType.IS_PART_OF, but it will depend on the actual runtime configuration if the required JetspeedPrincipalAssociationType is available.

If the corresponding JetspeedPrincipalAssociationType is not available, this method will simply return a empty list.

For a JetspeedPrincipalAssociationType.IS_PART_OF association, this will return all the nested roles which together represent the provided role.

For a JetspeedPrincipalAssociationType.IS_A association, this will return all the roles which extend the provided role.

Note: this method will only return the directly associated roles, not further derived associations.

Parameters:
to - The role for the to side of the association
associationName - The name of the JetspeedAssociationType to create

getRolesAssociatedFrom

java.util.List<Role> getRolesAssociatedFrom(Role from,
                                            java.lang.String associationName)
Retrieve all the roles which are associated from the provided role.

Default supported hierarchical associations are JetspeedPrincipalAssociationType.IS_A and JetspeedPrincipalAssociationType.IS_PART_OF, but it will depend on the actual runtime configuration if the required JetspeedPrincipalAssociationType is available.

If the corresponding JetspeedPrincipalAssociationType is not available, this method will simply return a empty list.

For a JetspeedPrincipalAssociationType.IS_PART_OF association, this will return (at most) the single role where the provided role is part of.

For a JetspeedPrincipalAssociationType.IS_A association, this will return all the roles which the provided role extends.

Note: this method will only return the directly associated role(s), not further derived associations.

Parameters:
from - The role for the from side of the association
associationName - The name of the JetspeedAssociationType to create


Copyright © 1999-2011 The Apache Software Foundation. All Rights Reserved.