org.apache.jetspeed.services.security.turbine
Class TurbineRoleManagement

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.security.turbine.TurbineRoleManagement
All Implemented Interfaces:
org.apache.turbine.services.Initable, RoleManagement, org.apache.turbine.services.Service

public class TurbineRoleManagement
extends org.apache.turbine.services.TurbineBaseService
implements RoleManagement

Default Jetspeed-Turbine Role Management implementation

Version:
$Id: TurbineRoleManagement.java,v 1.16 2005/05/17 02:34:37 taylor Exp $
Author:
David Sean Taylor, Mark Orciuch

Field Summary
protected static java.lang.String CACHING_ENABLE
           
protected  boolean cachingEnable
           
protected static java.lang.String CASCADE_DELETE
           
protected  boolean cascadeDelete
           
protected static boolean DEFAULT_CASCADE_DELETE
           
protected  JetspeedRunDataService runDataService
           
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.security.RoleManagement
DEFAULT_ROLE_NAME, SERVICE_NAME
 
Constructor Summary
TurbineRoleManagement()
           
 
Method Summary
protected  void addDefaultRolePSML(Role role)
           
 void addRole(Role role)
          Adds a Role into permanent storage.
 Role getRole(java.lang.String rolename)
          Retrieves a single Role for a given rolename principal.
 java.util.Iterator getRoles()
          Retrieves all Roles.
 java.util.Iterator getRoles(java.lang.String username)
          Retrieves all Roles for a given username principal.
protected  JetspeedRunData getRunData()
           
 void grantRole(java.lang.String username, java.lang.String rolename)
          Grants a role to a user.
 void grantRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
           
 boolean hasRole(java.lang.String username, java.lang.String rolename)
          Checks for the relationship of user has a role.
 boolean hasRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
           
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
 void removeRole(java.lang.String rolename)
          Removes a Role from the permanent store.
 void revokeRole(java.lang.String username, java.lang.String rolename)
          Revokes a role from a user.
 void revokeRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
           
protected  boolean roleExists(java.lang.String roleName)
          Check whether a specified role exists.
 void saveRole(Role role)
          Saves a Role into permanent storage.
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Field Detail

runDataService

protected JetspeedRunDataService runDataService

CASCADE_DELETE

protected static final java.lang.String CASCADE_DELETE
See Also:
Constant Field Values

DEFAULT_CASCADE_DELETE

protected static final boolean DEFAULT_CASCADE_DELETE
See Also:
Constant Field Values

cascadeDelete

protected boolean cascadeDelete

CACHING_ENABLE

protected static final java.lang.String CACHING_ENABLE
See Also:
Constant Field Values

cachingEnable

protected boolean cachingEnable
Constructor Detail

TurbineRoleManagement

public TurbineRoleManagement()
Method Detail

getRoles

public java.util.Iterator getRoles(java.lang.String username)
                            throws JetspeedSecurityException
Retrieves all Roles for a given username principal. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
getRoles in interface RoleManagement
Parameters:
username - a user principal identity to be retrieved.
Returns:
Iterator over all roles associated to the user principal (iterator of GroupRole objects keyed on group+role).
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getRoles

public java.util.Iterator getRoles()
                            throws JetspeedSecurityException
Retrieves all Roles. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
getRoles in interface RoleManagement
Returns:
Iterator over all roles.
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

addRole

public void addRole(Role role)
             throws JetspeedSecurityException
Adds a Role into permanent storage. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
addRole in interface RoleManagement
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

addDefaultRolePSML

protected void addDefaultRolePSML(Role role)
                           throws RoleException
Throws:
RoleException

saveRole

public void saveRole(Role role)
              throws JetspeedSecurityException
Saves a Role into permanent storage. The security service can throw a NotUniqueEntityException when the public credentials fail to meet the security provider-specific unique constraints. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
saveRole in interface RoleManagement
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

removeRole

public void removeRole(java.lang.String rolename)
                throws JetspeedSecurityException
Removes a Role from the permanent store. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
removeRole in interface RoleManagement
Parameters:
rolename - the principal identity of the role to be retrieved.
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

grantRole

public void grantRole(java.lang.String username,
                      java.lang.String rolename)
               throws JetspeedSecurityException
Grants a role to a user. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
grantRole in interface RoleManagement
Throws:
RoleException - when the security provider has a general failure retrieving users.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

grantRole

public void grantRole(java.lang.String username,
                      java.lang.String rolename,
                      java.lang.String groupname)
               throws JetspeedSecurityException
Specified by:
grantRole in interface RoleManagement
Throws:
JetspeedSecurityException

revokeRole

public void revokeRole(java.lang.String username,
                       java.lang.String rolename)
                throws JetspeedSecurityException
Revokes a role from a user. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
revokeRole in interface RoleManagement
Throws:
RoleException - when the security provider has a general failure retrieving users.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

revokeRole

public void revokeRole(java.lang.String username,
                       java.lang.String rolename,
                       java.lang.String groupname)
                throws JetspeedSecurityException
Specified by:
revokeRole in interface RoleManagement
Throws:
JetspeedSecurityException

hasRole

public boolean hasRole(java.lang.String username,
                       java.lang.String rolename)
                throws JetspeedSecurityException
Checks for the relationship of user has a role. Returns true when the user has the given role. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
hasRole in interface RoleManagement
Throws:
RoleException - when the security provider has a general failure retrieving users.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

hasRole

public boolean hasRole(java.lang.String username,
                       java.lang.String rolename,
                       java.lang.String groupname)
                throws JetspeedSecurityException
Specified by:
hasRole in interface RoleManagement
Throws:
JetspeedSecurityException

getRole

public Role getRole(java.lang.String rolename)
             throws JetspeedSecurityException
Retrieves a single Role for a given rolename principal. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
getRole in interface RoleManagement
Parameters:
rolename - a role principal identity to be retrieved.
Returns:
Role the role record retrieved.
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getRunData

protected JetspeedRunData getRunData()

roleExists

protected boolean roleExists(java.lang.String roleName)
                      throws RoleException
Check whether a specified role exists. The login name is used for looking up the account.

Parameters:
roleName - the name of the role to check for existence.
Returns:
true if the specified account exists
Throws:
RoleException - if there was a general db access error

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Parameters:
conf - The ServletConfig
Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.