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:
org.apache.jetspeed.security.PermissionManager, org.springframework.beans.factory.InitializingBean

public class PermissionManagerImpl
extends org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
implements org.apache.jetspeed.security.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
private static org.apache.commons.logging.Log log
           
private static ThreadLocal permissionsCache
           
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
PermissionManagerImpl()
           
 
Method Summary
 void addPermission(Permission permission)
           
 boolean checkPermission(Subject subject, Permission permission)
           
(package private)  org.apache.jetspeed.security.om.InternalPermission getInternalPermission(Permission permission)
           Returns the InternalPermission from a Permission.
(package private)  org.apache.jetspeed.security.om.InternalPrincipal getInternalPrincipal(String fullPath)
           Returns the InternalPrincipalfrom the full path.
 Collection getPermissions()
           
 Permissions getPermissions(Collection principals)
           
 Permissions getPermissions(Principal principal)
           
 Permissions getPermissions(String classname, String resource)
           
 Collection getPrincipals(Permission permission)
           
private  Collection getPrincipalsFullPath(Collection principals)
           Get the full path for the Principalin the collection.
private  HashSet getSecurityPermissions(Collection omPermissions)
           Iterate through a collection of InternalPermissionand build a unique collection of Permission.
 void grantPermission(Principal principal, Permission permission)
           
 boolean permissionExists(Permission permission)
           
 void removePermission(Permission permission)
           
 void removePermissions(Principal principal)
           
 void revokePermission(Principal principal, Permission permission)
           
 int updatePermission(Permission permission, Collection principals)
           
 
Methods inherited from class org.springframework.orm.ojb.support.PersistenceBrokerDaoSupport
checkDaoConfig, 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
 

Field Detail

log

private static final org.apache.commons.logging.Log log

permissionsCache

private static ThreadLocal permissionsCache
Constructor Detail

PermissionManagerImpl

public PermissionManagerImpl()
Method Detail

getPermissions

public Permissions getPermissions(Principal principal)
Specified by:
getPermissions in interface org.apache.jetspeed.security.PermissionManager
See Also:
PermissionManager.getPermissions(java.security.Principal)

getPermissions

public Permissions getPermissions(Collection principals)
Specified by:
getPermissions in interface org.apache.jetspeed.security.PermissionManager
See Also:
PermissionManager.getPermissions(java.util.Collection)

getPrincipalsFullPath

private Collection getPrincipalsFullPath(Collection principals)

Get the full path for the Principalin the collection.

Parameters:
principals - The collection of principals.
Returns:
The collection of principals names.

getSecurityPermissions

private HashSet getSecurityPermissions(Collection omPermissions)

Iterate through a collection of InternalPermissionand build a unique collection of Permission.

Parameters:
omPermissions - The collection of InternalPermission.

addPermission

public void addPermission(Permission permission)
                   throws org.apache.jetspeed.security.SecurityException
Specified by:
addPermission in interface org.apache.jetspeed.security.PermissionManager
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
PermissionManager.addPermission(java.security.Permission)

removePermission

public void removePermission(Permission permission)
                      throws org.apache.jetspeed.security.SecurityException
Specified by:
removePermission in interface org.apache.jetspeed.security.PermissionManager
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
PermissionManager.removePermission(java.security.Permission)

removePermissions

public void removePermissions(Principal principal)
                       throws org.apache.jetspeed.security.SecurityException
Specified by:
removePermissions in interface org.apache.jetspeed.security.PermissionManager
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
PermissionManager.removePermissions(java.security.Principal)

grantPermission

public void grantPermission(Principal principal,
                            Permission permission)
                     throws org.apache.jetspeed.security.SecurityException
Specified by:
grantPermission in interface org.apache.jetspeed.security.PermissionManager
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
PermissionManager.grantPermission(java.security.Principal, java.security.Permission)

permissionExists

public boolean permissionExists(Permission permission)
Specified by:
permissionExists in interface org.apache.jetspeed.security.PermissionManager
See Also:
PermissionManager.permissionExists(java.security.Permission)

revokePermission

public void revokePermission(Principal principal,
                             Permission permission)
                      throws org.apache.jetspeed.security.SecurityException
Specified by:
revokePermission in interface org.apache.jetspeed.security.PermissionManager
Throws:
org.apache.jetspeed.security.SecurityException
See Also:
PermissionManager.revokePermission(java.security.Principal, java.security.Permission)

getInternalPrincipal

org.apache.jetspeed.security.om.InternalPrincipal getInternalPrincipal(String fullPath)

Returns the InternalPrincipalfrom the full path.

Parameters:
fullPath - The full path.
Returns:
The InternalPrincipal.

getInternalPermission

org.apache.jetspeed.security.om.InternalPermission getInternalPermission(Permission permission)

Returns the InternalPermission from a Permission.

Parameters:
permission - The permission.
Returns:
The InternalPermission.

checkPermission

public boolean checkPermission(Subject subject,
                               Permission permission)
Specified by:
checkPermission in interface org.apache.jetspeed.security.PermissionManager

getPermissions

public Collection getPermissions()
Specified by:
getPermissions in interface org.apache.jetspeed.security.PermissionManager

getPermissions

public Permissions getPermissions(String classname,
                                  String resource)
Specified by:
getPermissions in interface org.apache.jetspeed.security.PermissionManager

updatePermission

public int updatePermission(Permission permission,
                            Collection principals)
                     throws org.apache.jetspeed.security.SecurityException
Specified by:
updatePermission in interface org.apache.jetspeed.security.PermissionManager
Throws:
org.apache.jetspeed.security.SecurityException

getPrincipals

public Collection getPrincipals(Permission permission)
Specified by:
getPrincipals in interface org.apache.jetspeed.security.PermissionManager


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