Class 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 Detail

      • People

        public People()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception
        Specified by:
        afterPropertiesSet in interface org.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 for
        recurse - 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