net.sourceforge.jfacets.acegi
Class AcegiProfileRepository

java.lang.Object
  extended by net.sourceforge.jfacets.acegi.AcegiProfileRepository
All Implemented Interfaces:
INavigableProfileRepository, IProfileRepository

public class AcegiProfileRepository
extends java.lang.Object
implements INavigableProfileRepository

The AcegiProfileRepository enable easy use of WebFacets with Acegi. It relies on injected UserDetailsService in order to retrieve users and related roles.
IMPORTANT : Acegi does not support hierarchical roles and does not allow to get informations about a role. Thereby, in order to use these features, your UserDetailsService has to implement the IHierarchicalUserDetailsService interface. Otherwise, it'll work only for flat roles and you will only be able to use facets for user profiles (not roles).

Author:
Remi VANKEISBELCK

Field Summary
private  java.util.HashMap<java.lang.String,org.acegisecurity.userdetails.UserDetails> cachedUserDetails
           
private static JFacetsLogger logger
           
private  boolean useCache
           
private  org.acegisecurity.userdetails.UserDetailsService userDetailsService
          the injected UserDetailsService
 
Constructor Summary
AcegiProfileRepository()
           
 
Method Summary
 org.acegisecurity.GrantedAuthority getGrantedAuthority(java.lang.String roleName)
          Return the GrantedAuthority for passed role name.
 org.acegisecurity.GrantedAuthority[] getParentRoles(org.acegisecurity.GrantedAuthority grantedAuthority)
          Return a list of parent roles for passed Granted Authority.
 IProfile getProfileById(java.lang.String profileId)
          Return a profile by ID.
 IProfile[] getRootProfiles()
           
 IProfile[] getSubProfiles(IProfile parentProfile)
           
 IProfile[] getSuperProfiles(IProfile profile)
          Return the super profiles for passed profile if found, a 0-length array if not found.
 org.acegisecurity.userdetails.UserDetailsService getUserDetailsService()
          get the UserDetailsService
 boolean isUseCache()
           
 void setUseCache(boolean useCache)
           
 void setUserDetailsService(org.acegisecurity.userdetails.UserDetailsService userDetailsService)
          set the UserDetailsService
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userDetailsService

private org.acegisecurity.userdetails.UserDetailsService userDetailsService
the injected UserDetailsService


logger

private static final JFacetsLogger logger

cachedUserDetails

private java.util.HashMap<java.lang.String,org.acegisecurity.userdetails.UserDetails> cachedUserDetails

useCache

private boolean useCache
Constructor Detail

AcegiProfileRepository

public AcegiProfileRepository()
Method Detail

getProfileById

public IProfile getProfileById(java.lang.String profileId)
Return a profile by ID. Returns either a UserDetailsProfile in case passed profileId represents a role name, or a GrantedAuthorityProfile if passed profileId identifies a valid user (uses UserDetailsService).

Specified by:
getProfileById in interface IProfileRepository

getSuperProfiles

public IProfile[] getSuperProfiles(IProfile profile)
Return the super profiles for passed profile if found, a 0-length array if not found.

Specified by:
getSuperProfiles in interface IProfileRepository

getGrantedAuthority

public org.acegisecurity.GrantedAuthority getGrantedAuthority(java.lang.String roleName)
Return the GrantedAuthority for passed role name.


getParentRoles

public org.acegisecurity.GrantedAuthority[] getParentRoles(org.acegisecurity.GrantedAuthority grantedAuthority)
Return a list of parent roles for passed Granted Authority.


getUserDetailsService

public org.acegisecurity.userdetails.UserDetailsService getUserDetailsService()
get the UserDetailsService


setUserDetailsService

public void setUserDetailsService(org.acegisecurity.userdetails.UserDetailsService userDetailsService)
set the UserDetailsService


isUseCache

public boolean isUseCache()

setUseCache

public void setUseCache(boolean useCache)

getRootProfiles

public IProfile[] getRootProfiles()
Specified by:
getRootProfiles in interface INavigableProfileRepository

getSubProfiles

public IProfile[] getSubProfiles(IProfile parentProfile)
Specified by:
getSubProfiles in interface INavigableProfileRepository


Copyright © 2010. All Rights Reserved.