Package org.alfresco.repo.template
Class People
- java.lang.Object
-
- org.alfresco.repo.processor.BaseProcessorExtension
-
- org.alfresco.repo.template.BaseTemplateProcessorExtension
-
- org.alfresco.repo.template.People
-
- All Implemented Interfaces:
org.alfresco.processor.ProcessorExtension,TemplateProcessorExtension,org.springframework.beans.factory.InitializingBean
public class People extends BaseTemplateProcessorExtension implements org.springframework.beans.factory.InitializingBean
People and users support in FreeMarker templates.- Author:
- Kevin Roast
-
-
Constructor Summary
Constructors Constructor Description People()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterPropertiesSet()java.util.Map<java.lang.String,java.lang.Boolean>getCapabilities(TemplateNode person)Gets a map of capabilities (boolean assertions) for the given person.java.util.List<TemplateNode>getContainerGroups(TemplateNode person)Gets the groups that contain the specified authorityTemplateNodegetGroup(java.lang.String groupName)Gets the Group given the group namejava.util.List<TemplateNode>getMembers(TemplateNode group)Gets the members (people) of a group (including all sub-groups)java.util.List<TemplateNode>getMembers(TemplateNode group, boolean recurse)Gets the members (people) of a groupTemplateNodegetPerson(java.lang.String username)Gets the Person given the usernamebooleanisAccountEnabled(TemplateNode person)Return true if the specified user account is enabled.booleanisAdmin(TemplateNode person)Return true if the specified user is an Administrator authority.booleanisGuest(TemplateNode person)Return true if the specified user is an Guest authority.voidsetAuthenticationService(MutableAuthenticationService authenticationService)Sets the authentication service.voidsetAuthorityDAO(AuthorityDAO authorityDAO)Set the authority DAOvoidsetAuthorityService(AuthorityService authorityService)Set the authority servicevoidsetPersonService(PersonService personService)Set the person servicevoidsetServiceRegistry(ServiceRegistry serviceRegistry)Set the service registryvoidsetStoreUrl(java.lang.String storeRef)Set the default store reference-
Methods inherited from class org.alfresco.repo.template.BaseTemplateProcessorExtension
getTemplateImageResolver, setTemplateImageResolver
-
Methods inherited from class org.alfresco.repo.processor.BaseProcessorExtension
getExtensionName, register, setExtensionName, setProcessor
-
-
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
java.lang.Exception
-
setStoreUrl
public void setStoreUrl(java.lang.String storeRef)
Set the default store reference- Parameters:
storeRef- the default store reference
-
setServiceRegistry
public void setServiceRegistry(ServiceRegistry serviceRegistry)
Set the service registry- Parameters:
serviceRegistry- the service registry
-
setAuthorityDAO
public void setAuthorityDAO(AuthorityDAO authorityDAO)
Set the authority DAO- Parameters:
authorityDAO- authority dao
-
setAuthorityService
public void setAuthorityService(AuthorityService authorityService)
Set the authority service- Parameters:
authorityService- The authorityService to set.
-
setPersonService
public void setPersonService(PersonService personService)
Set the person service- Parameters:
personService- The personService to set.
-
setAuthenticationService
public void setAuthenticationService(MutableAuthenticationService authenticationService)
Sets the authentication service.- Parameters:
authenticationService- the new authentication service
-
getPerson
public TemplateNode getPerson(java.lang.String username)
Gets the Person given the username- Parameters:
username- the username of the person to get- Returns:
- the person node (type cm:person) or null if no such person exists
-
getGroup
public TemplateNode getGroup(java.lang.String groupName)
Gets the Group given the group name- Parameters:
groupName- name of group to get- Returns:
- the group node (type usr:authorityContainer) or null if no such group exists
-
getMembers
public java.util.List<TemplateNode> getMembers(TemplateNode group)
Gets the members (people) of a group (including all sub-groups)- Parameters:
group- the group to retrieve members for- Returns:
- list of nodes representing the group members
-
getMembers
public java.util.List<TemplateNode> getMembers(TemplateNode group, boolean recurse)
Gets the members (people) of a group- Parameters:
group- the group to retrieve members forrecurse- recurse into sub-groups- Returns:
- list of nodes representing the group members
-
getContainerGroups
public java.util.List<TemplateNode> getContainerGroups(TemplateNode person)
Gets the groups that contain the specified authority- Parameters:
person- the user (cm:person) to get the containing groups for- Returns:
- the containing groups as a List of TemplateNode objects, can be null
-
isAdmin
public boolean isAdmin(TemplateNode person)
Return true if the specified user is an Administrator authority.- Parameters:
person- to test- Returns:
- true if an admin, false otherwise
-
isGuest
public boolean isGuest(TemplateNode person)
Return true if the specified user is an Guest authority.- Parameters:
person- to test- Returns:
- true if a guest user, false otherwise
-
getCapabilities
public java.util.Map<java.lang.String,java.lang.Boolean> getCapabilities(TemplateNode person)
Gets a map of capabilities (boolean assertions) for the given person.- Parameters:
person- the person- Returns:
- the capability map
-
isAccountEnabled
public boolean isAccountEnabled(TemplateNode person)
Return true if the specified user account is enabled.- Parameters:
person- to test- Returns:
- true if account enabled, false if disabled
-
-