org.apache.jetspeed.security.impl
Class PermissionManagerImpl

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
          extended by org.apache.jetspeed.security.impl.PermissionManagerImpl
All Implemented Interfaces:
PermissionManager, org.springframework.beans.factory.InitializingBean

public class PermissionManagerImpl
extends org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
implements PermissionManager

Implementation for managing Permissionand permission association to Principal. Permissions are used to manage Principals access entitlement on specified resources.

For instance:


 
  
   grant principal o.a.j.security.UserPrincipal "theUserPrincipal"
   {
       permission o.a.j.security.PortletPermission "myportlet", "view,edit,minimize,maximize";
   };
   
  
 
 
  <pre>

Author:
<a href="mailto:dlestrat@apache.org">David Le Strat</a>

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
PermissionManagerImpl()
           
 
Method Summary
 void addPermission(java.security.Permission permission)
           Adds a permission definition.
 boolean checkPermission(javax.security.auth.Subject subject, java.security.Permission permission)
           Check permission for the given subject's access to the resource protected by the permission This is an abstraction introduced in M4 for Permission Manager implementations NOT founded upon the a Java security policy.
 java.util.Collection getPermissions()
          Retrieve a collection of all Permissions in the system ordered by Permission Type, resource Note that we return a collection of InternalPrincipal
 java.security.Permissions getPermissions(java.util.Collection principals)
           Gets the Permissionsgiven a collection of Principal.
 java.security.Permissions getPermissions(java.security.Principal principal)
           Gets the Permissionsgiven a Principal.
 java.security.Permissions getPermissions(java.lang.String classname, java.lang.String resource)
          Retrieve a list of all Permissions in the system for a given resource The resource can be a prefix, for example "j2-admin" will retrieve all portlet permissions starting with j2-admin
 java.util.Collection getPrincipals(java.security.Permission permission)
          Given a permission, return all principals granted to that permission
 void grantPermission(java.security.Principal principal, java.security.Permission permission)
           Grant a Permissionto a given Principal.
 boolean permissionExists(java.security.Permission permission)
           Whether the given permission exists.
 void removePermission(java.security.Permission permission)
           Remove all instances of a given permission.
 void removePermissions(java.security.Principal principal)
           Remove all permissions for a given principal.
 void revokePermission(java.security.Principal principal, java.security.Permission permission)
           Revoke a Permissionfrom a given Principal.
 int updatePermission(java.security.Permission permission, java.util.Collection principals)
          Update the collection of principals on the given principal, appropriately granting or revoking principals to the given permission.
 
Methods inherited from class org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, closePersistenceBrokerIfNecessary, convertOjbAccessException, createPersistenceBrokerTemplate, getJcdAlias, getPersistenceBroker, getPersistenceBrokerTemplate, releasePersistenceBroker, setJcdAlias, setPersistenceBrokerTemplate
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PermissionManagerImpl

public PermissionManagerImpl()
Method Detail

getPermissions

public java.security.Permissions getPermissions(java.security.Principal principal)
Description copied from interface: PermissionManager

Gets the Permissionsgiven a Principal.

Specified by:
getPermissions in interface PermissionManager
Parameters:
principal - The principal.
Returns:
The permissions.
See Also:
PermissionManager.getPermissions(java.security.Principal)

getPermissions

public java.security.Permissions getPermissions(java.util.Collection principals)
Description copied from interface: PermissionManager

Gets the Permissionsgiven a collection of Principal.

Specified by:
getPermissions in interface PermissionManager
Parameters:
principals - A collection of principal.
Returns:
The permissions.
See Also:
PermissionManager.getPermissions(java.util.Collection)

addPermission

public void addPermission(java.security.Permission permission)
                   throws SecurityException
Description copied from interface: PermissionManager

Adds a permission definition.

Specified by:
addPermission in interface PermissionManager
Parameters:
permission - The permission to add.
Throws:
SecurityException
See Also:
PermissionManager.addPermission(java.security.Permission)

removePermission

public void removePermission(java.security.Permission permission)
                      throws SecurityException
Description copied from interface: PermissionManager

Remove all instances of a given permission.

Specified by:
removePermission in interface PermissionManager
Parameters:
permission - The permission to remove.
Throws:
SecurityException
See Also:
PermissionManager.removePermission(java.security.Permission)

removePermissions

public void removePermissions(java.security.Principal principal)
                       throws SecurityException
Description copied from interface: PermissionManager

Remove all permissions for a given principal.

Specified by:
removePermissions in interface PermissionManager
Parameters:
principal - The principal.
Throws:
SecurityException
See Also:
PermissionManager.removePermissions(java.security.Principal)

grantPermission

public void grantPermission(java.security.Principal principal,
                            java.security.Permission permission)
                     throws SecurityException
Description copied from interface: PermissionManager

Grant a Permissionto a given Principal.

Specified by:
grantPermission in interface PermissionManager
Parameters:
principal - The principal.
permission - The permission.
Throws:
SecurityException
See Also:
PermissionManager.grantPermission(java.security.Principal, java.security.Permission)

permissionExists

public boolean permissionExists(java.security.Permission permission)
Description copied from interface: PermissionManager

Whether the given permission exists.

Specified by:
permissionExists in interface PermissionManager
Parameters:
permission - The permission to look for.
Returns:
Whether the permission exists.
See Also:
PermissionManager.permissionExists(java.security.Permission)

revokePermission

public void revokePermission(java.security.Principal principal,
                             java.security.Permission permission)
                      throws SecurityException
Description copied from interface: PermissionManager

Revoke a Permissionfrom a given Principal.

Specified by:
revokePermission in interface PermissionManager
Parameters:
principal - The principal.
permission - The permission.
Throws:
SecurityException
See Also:
PermissionManager.revokePermission(java.security.Principal, java.security.Permission)

checkPermission

public boolean checkPermission(javax.security.auth.Subject subject,
                               java.security.Permission permission)
Description copied from interface: PermissionManager

Check permission for the given subject's access to the resource protected by the permission This is an abstraction introduced in M4 for Permission Manager implementations NOT founded upon the a Java security policy.

Specified by:
checkPermission in interface PermissionManager
Parameters:
subject - The Java subject.
permission - The permission, usually a portlet, page or folder type permission.
Returns:
true if the subject has access to the permission protected resource, false if the subject does not have access.

getPermissions

public java.util.Collection getPermissions()
Description copied from interface: PermissionManager
Retrieve a collection of all Permissions in the system ordered by Permission Type, resource Note that we return a collection of InternalPrincipal

Specified by:
getPermissions in interface PermissionManager
Returns:
A Java Security collection of InternalPrincipal

getPermissions

public java.security.Permissions getPermissions(java.lang.String classname,
                                                java.lang.String resource)
Description copied from interface: PermissionManager
Retrieve a list of all Permissions in the system for a given resource The resource can be a prefix, for example "j2-admin" will retrieve all portlet permissions starting with j2-admin

Specified by:
getPermissions in interface PermissionManager
Returns:
A Java Security collection of Permissions

updatePermission

public int updatePermission(java.security.Permission permission,
                            java.util.Collection principals)
                     throws SecurityException
Description copied from interface: PermissionManager
Update the collection of principals on the given principal, appropriately granting or revoking principals to the given permission.

Specified by:
updatePermission in interface PermissionManager
Parameters:
permission - Permission to be updated
principals - The new collection of principals based on BasePrincipal to be associated with this permission
Returns:
Throws:
SecurityException

getPrincipals

public java.util.Collection getPrincipals(java.security.Permission permission)
Description copied from interface: PermissionManager
Given a permission, return all principals granted to that permission

Specified by:
getPrincipals in interface PermissionManager
Returns:
A collection of Java Security Permission objects


Copyright © 1999-2010 Apache Software Foundation. All Rights Reserved.