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

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.TurbinePermissionManagement
All Implemented Interfaces:
org.apache.turbine.services.Initable, PermissionManagement, org.apache.turbine.services.Service

public class TurbinePermissionManagement
extends org.apache.turbine.services.TurbineBaseService
implements PermissionManagement

Default Jetspeed-Turbine Permission Management implementation

Version:
$Id: TurbinePermissionManagement.java,v 1.11 2004/05/18 19:58:25 jford Exp $
Author:
David Sean Taylor

Field Summary
 
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.PermissionManagement
SERVICE_NAME
 
Constructor Summary
TurbinePermissionManagement()
           
 
Method Summary
 void addPermission(Permission permission)
          Adds a Permission into permanent storage.
 Permission getPermission(java.lang.String permissionName)
          Retrieves a single Permission for a given permissionName principal.
 java.util.Iterator getPermissions()
          Retrieves all Permissions.
 java.util.Iterator getPermissions(java.lang.String rolename)
          Retrieves all Permissions for a given rolename principal.
protected  JetspeedRunData getRunData()
           
 void grantPermission(java.lang.String roleName, java.lang.String permissionName)
          Grants a permission to a role.
 boolean hasPermission(java.lang.String roleName, java.lang.String permissionName)
          Checks for the relationship of role has a permission.
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
protected  boolean permissionExists(java.lang.String permissionName)
          Check whether a specified permission exists.
 void removePermission(java.lang.String permissionName)
          Removes a Permission from the permanent store.
 void revokePermission(java.lang.String roleName, java.lang.String permissionName)
          Revokes a permission from a role.
 void savePermission(Permission permission)
          Saves a Permission 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
 

Constructor Detail

TurbinePermissionManagement

public TurbinePermissionManagement()
Method Detail

getPermissions

public java.util.Iterator getPermissions(java.lang.String rolename)
                                  throws JetspeedSecurityException
Retrieves all Permissions 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:
getPermissions in interface PermissionManagement
Parameters:
rolename - a role name identity to be retrieved.
Returns:
Iterator over all permissions associated to the role principal.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getPermissions

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

Specified by:
getPermissions in interface PermissionManagement
Returns:
Iterator over all permissions.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

addPermission

public void addPermission(Permission permission)
                   throws JetspeedSecurityException
Adds a Permission 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:
addPermission in interface PermissionManagement
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

savePermission

public void savePermission(Permission permission)
                    throws JetspeedSecurityException
Saves a Permission 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:
savePermission in interface PermissionManagement
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

removePermission

public void removePermission(java.lang.String permissionName)
                      throws JetspeedSecurityException
Removes a Permission 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:
removePermission in interface PermissionManagement
Parameters:
permissionName - the principal identity of the permission to be retrieved.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

grantPermission

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

Specified by:
grantPermission in interface PermissionManagement
Parameters:
roleName - grant a permission to this role.
permissionName - the permission to grant to the role.
Throws:
PermissionException - when the security provider has a general failure retrieving permissions.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

revokePermission

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

Specified by:
revokePermission in interface PermissionManagement
Parameters:
roleName - grant a permission to this role.
permissionName - the permission to grant to the role.
Throws:
PermissionException - when the security provider has a general failure retrieving permissions.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

hasPermission

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

Specified by:
hasPermission in interface PermissionManagement
Parameters:
roleName - grant a permission to this role.
permissionName - the permission to grant to the role.
Throws:
PermissionException - when the security provider has a general failure retrieving permissions.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getPermission

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

Specified by:
getPermission in interface PermissionManagement
Parameters:
permissionName - a permission principal identity to be retrieved.
Returns:
Permission the permission record retrieved.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getRunData

protected JetspeedRunData getRunData()

permissionExists

protected boolean permissionExists(java.lang.String permissionName)
                            throws PermissionException
Check whether a specified permission exists. The login name is used for looking up the account.

Parameters:
permissionName - the name of the permission to check for existence.
Returns:
true if the specified account exists
Throws:
PermissionException - 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.