org.apache.jackrabbit.core.security.principal
Class PrincipalManagerImpl

java.lang.Object
  extended by org.apache.jackrabbit.core.security.principal.PrincipalManagerImpl
All Implemented Interfaces:
PrincipalManager

public class PrincipalManagerImpl
extends Object
implements PrincipalManager

This principal manager implementation uses the DefaultPrincipalProvider in order to dispatch the respective requests and assemble the required data. It is bound to a session and therefore obliges the access restrictions of the respective subject.


Field Summary
 
Fields inherited from interface org.apache.jackrabbit.api.security.principal.PrincipalManager
SEARCH_TYPE_ALL, SEARCH_TYPE_GROUP, SEARCH_TYPE_NOT_GROUP
 
Constructor Summary
PrincipalManagerImpl(Session session, PrincipalProvider[] providers)
          Creates a new default principal manager implementation.
 
Method Summary
 PrincipalIterator findPrincipals(String simpleFilter)
          Gets the principals matching a simple filter expression applied against the principal name.
 PrincipalIterator findPrincipals(String simpleFilter, int searchType)
          Gets the principals matching a simple filter expression applied against the principal name AND the specified search type.
 Principal getEveryone()
          Returns the Principal which is implicitly applied to every subject.
 PrincipalIterator getGroupMembership(Principal principal)
          Returns an iterator over all group principals for which the given principal is either direct or indirect member of.
 Principal getPrincipal(String principalName)
          Returns the principal with the given name if is known to this manager (with respect to the sessions access rights).
 PrincipalIterator getPrincipals(int searchType)
          Returns all Principals matching the specified search type.
 boolean hasPrincipal(String principalName)
          Checks if the principal with the given name is known to this manager (in respect to the sessions access rights).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrincipalManagerImpl

public PrincipalManagerImpl(Session session,
                            PrincipalProvider[] providers)
Creates a new default principal manager implementation.

Parameters:
session - the underlying session
providers - the providers
Method Detail

hasPrincipal

public boolean hasPrincipal(String principalName)
Checks if the principal with the given name is known to this manager (in respect to the sessions access rights). If this method returns true then the following expression evaluates to true as well: PrincipalManager.getPrincipal(name).getName().equals(name)

Specified by:
hasPrincipal in interface PrincipalManager
Parameters:
principalName - the name of the principal to check
Returns:
return true if the principal with this name is known to this manager; false otherwise.

getPrincipal

public Principal getPrincipal(String principalName)
Returns the principal with the given name if is known to this manager (with respect to the sessions access rights). Please note that due to security reasons Group principals will only reveal those members that are visible to the Session this PrincipalManager has been built for.

Specified by:
getPrincipal in interface PrincipalManager
Parameters:
principalName - the name of the principal to retrieve
Returns:
return the requested principal or null if not exists

findPrincipals

public PrincipalIterator findPrincipals(String simpleFilter)
Gets the principals matching a simple filter expression applied against the principal name. TODO: define the filter expression.
An implementation may limit the number of principals returned. If there are no matching principals, an empty iterator is returned.

Specified by:
findPrincipals in interface PrincipalManager
Returns:
a PrincipalIterator over the Principals matching the given filter.

findPrincipals

public PrincipalIterator findPrincipals(String simpleFilter,
                                        int searchType)
Gets the principals matching a simple filter expression applied against the principal name AND the specified search type. TODO: define the filter expression.
An implementation may limit the number of principals returned. If there are no matching principals, an empty iterator is returned.

Specified by:
findPrincipals in interface PrincipalManager
searchType - Any of the following constants:
Returns:
a PrincipalIterator over the Principals matching the given filter and search type.

getPrincipals

public PrincipalIterator getPrincipals(int searchType)
Returns all Principals matching the specified search type.

Specified by:
getPrincipals in interface PrincipalManager
Parameters:
searchType -
Returns:
a PrincipalIterator over all the Principals matching the given search type.

getGroupMembership

public PrincipalIterator getGroupMembership(Principal principal)
Returns an iterator over all group principals for which the given principal is either direct or indirect member of.

Example:
If Principal P is member of Group A, and Group A is member of Group B, this method will return Principal A and Principal B.

Specified by:
getGroupMembership in interface PrincipalManager
Parameters:
principal - the principal to return it's membership from.
Returns:
an iterator returning all groups the given principal is member of.

getEveryone

public Principal getEveryone()
Returns the Principal which is implicitly applied to every subject.

Specified by:
getEveryone in interface PrincipalManager
Returns:
the 'everyone' principal


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.