com.day.cq.security.impl.privileges
Class CqPrivilegeManager

java.lang.Object
  extended by com.day.cq.security.impl.privileges.CqPrivilegeManager
All Implemented Interfaces:
PrivilegeManager

public class CqPrivilegeManager
extends Object
implements PrivilegeManager

Access to existing Privileges and facility to query for Privileges In most cases there are two kind of parivileges, the simple, and the path dependant. Both could easyly registred via an entry in the content. For both types there can be defaul-factories. And for everything else ther are custom factories.


Constructor Summary
CqPrivilegeManager()
           
CqPrivilegeManager(com.day.crx.CRXSession session)
           
 
Method Summary
protected  void activate(org.osgi.service.component.ComponentContext context)
           
 void addFactory(PrivilegeFactory factory)
           
protected  void deactivate(org.osgi.service.component.ComponentContext context)
           
 Privilege getPrivilege(String privilege, Authorizable auth, Session session)
          Retrieve the Privilege witht the given path for the given authorizable, use the Session to access the repository
 Collection<Privilege> getPrivileges(Authorizable auth, Session session)
          Access all privilages an Authorizable are granted.
 Collection<String> getPrivileges(Session session)
          todo: access rights? => would be the read on the handles
 Privilege grantPrivilege(String privPath, Authorizable auth, Session session)
          Set the given Privilege to the Authorizable with the given session
 void removeFactory(PrivilegeFactory factory)
           
 void revokePrivilege(Privilege priv, Authorizable auth, Session session)
          Revkes the given privilge from the authorizables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CqPrivilegeManager

public CqPrivilegeManager()

CqPrivilegeManager

public CqPrivilegeManager(com.day.crx.CRXSession session)
                   throws RepositoryException
Throws:
RepositoryException
Method Detail

getPrivilege

public Privilege getPrivilege(String privilege,
                              Authorizable auth,
                              Session session)
                       throws AccessDeniedException
Retrieve the Privilege witht the given path for the given authorizable, use the Session to access the repository

Specified by:
getPrivilege in interface PrivilegeManager
Parameters:
privilege - identifier of the privilege
auth - to accss the privilieg for
session - Session to access the access the repository
Returns:
Privilege if one defined or null if none set
Throws:
AccessDeniedException - in case Session misses privileges to access

grantPrivilege

public Privilege grantPrivilege(String privPath,
                                Authorizable auth,
                                Session session)
                         throws AccessDeniedException
Set the given Privilege to the Authorizable with the given session

Specified by:
grantPrivilege in interface PrivilegeManager
Parameters:
privPath - identifier of the privilege
auth - authorizable to set the privilege to
session - session to set the privilege with
Returns:
Privilge newly set
Throws:
AccessDeniedException - in case session misses privileges to grant Privileg

revokePrivilege

public void revokePrivilege(Privilege priv,
                            Authorizable auth,
                            Session session)
                     throws AccessDeniedException
Revkes the given privilge from the authorizables

Specified by:
revokePrivilege in interface PrivilegeManager
Parameters:
priv - to remove
auth - the authorizable to remove the Privilege from
session - to perform the operation
Throws:
AccessDeniedException - in case the Session lacks access right to revkoe Privileges

getPrivileges

public Collection<Privilege> getPrivileges(Authorizable auth,
                                           Session session)
                                    throws AccessDeniedException
Access all privilages an Authorizable are granted.

Specified by:
getPrivileges in interface PrivilegeManager
Parameters:
auth - to query
session - to query with
Returns:
all granted Privilages of the given Authorizable
Throws:
AccessDeniedException - in case the Session lacks access rights

getPrivileges

public Collection<String> getPrivileges(Session session)
                                 throws AccessDeniedException
todo: access rights? => would be the read on the handles

Specified by:
getPrivileges in interface PrivilegeManager
Parameters:
session - to use for query
Returns:
all Priviliges identifiers that are known to this Manager
Throws:
AccessDeniedException - in case Session lacks acces rights

activate

protected void activate(org.osgi.service.component.ComponentContext context)
                 throws RepositoryException
Throws:
RepositoryException

deactivate

protected void deactivate(org.osgi.service.component.ComponentContext context)

addFactory

public void addFactory(PrivilegeFactory factory)

removeFactory

public void removeFactory(PrivilegeFactory factory)


Copyright © 2008 Day Management AG. All Rights Reserved.