<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<!-- ========================================================= -->
<!-- The configuration of the Authority Service Implementation -->
<!-- ========================================================= -->

<!--                                                                          -->
<!-- This implementation supports the identification of users as admin users. -->
<!-- It also supports groups and allows groups and users to be arranged into  -->
<!-- hierarchies.                                                             -->
<!--                                                                          -->
<beans>

    <bean id="authorityService" class="org.alfresco.repo.security.authority.AuthorityServiceImpl">
        <property name="personService">
            <ref bean="personService" />
        </property>
        <property name="nodeService">
            <ref bean="mlAwareNodeService" />
        </property>
        <property name="tenantService">
            <ref bean="tenantService"/>
        </property>
        <property name="authorityDAO">
            <ref bean="authorityDAO" />
        </property>
        <property name="userNameMatcher">
            <ref bean="userNameMatcher" />
        </property>
        <property name="authenticationService">
            <ref bean="authenticationService" />
        </property>
        <property name="permissionServiceSPI">
            <ref bean="permissionServiceImpl" />
        </property>
        <!--                                                                  -->
        <!-- A list of groups with admin rights.                              -->
        <!--                                                                  -->
        <property name="adminGroups">
            <set>
                <value>ALFRESCO_ADMINISTRATORS</value>
            </set>
        </property>
        <!--                                                                  -->
        <!-- A list of groups with guest rights.                              -->
        <!--                                                                  -->
        <property name="guestGroups">
            <set>
            </set>
        </property>
    </bean>

    <!-- Authority DAO that stores group information along with user information, -->
    <!-- in the repository.                                                       -->
    <!--                                                                          -->
    <!-- This bean uses the authorityLookupCache configured in cache-context.xml  -->
    <!--                                                                          -->

    <bean id="authorityDAO" class="org.alfresco.repo.security.authority.AuthorityDAOImpl" init-method="init">   
        <property name="storeUrl">
            <value>${spaces.store}</value>
        </property>
        <property name="nodeService">
            <ref bean="mlAwareNodeService" />
        </property>
        <property name="searchService">
            <ref bean="admSearchService" />
        </property>
        <property name="namespacePrefixResolver">
            <ref bean="namespaceService" />
        </property>
        <property name="dictionaryService">
            <ref bean="dictionaryService" />
        </property>
        <property name="personService">
            <ref bean="personService" />
        </property>
        <property name="tenantService">
            <ref bean="tenantService" />
        </property>
        <property name="authorityLookupCache">
            <ref bean="authorityLookupCache" />
        </property>
        <property name="userAuthorityCache">
            <ref bean="userToAuthorityCache" />
        </property>
        <property name="policyComponent">
            <ref bean="policyComponent"/>
        </property>
        <property name="aclDao">
            <ref bean="aclDaoComponent" />
        </property>
        
    </bean>
    
    
    <!--  Expose the Authority service to Java script API ROOT Scopeable object called "groups" -->
    <bean id="authorityServiceScript" parent="baseJavaScriptExtension" class="org.alfresco.repo.security.authority.script.ScriptAuthorityService">
        <property name="extensionName">
            <value>groups</value>
        </property>
        <property name="authorityService" ref="AuthorityService"/>
    </bean>

</beans>