This is also done via XML files:
<?xml version="1.0" encoding="UTF-8"?> <view:view xmlns:view="http://www.alfresco.org/view/repository/1.0" xmlns:cm="http://www.alfresco.org/model/content/1.0" xmlns:sys="http://www.alfresco.org/model/system/1.0"> <view:reference view:pathref="${system.authorities_container.childname}"> <view:associations> <sys:children> <cm:authorityContainer view:childName="cm:GROUP_Knowledge Base Consumers"> <view:aspects> <sys:referenceable /> </view:aspects> <view:properties> <sys:node-uuid>Knowledge Base Consumers</sys:node-uuid> <cm:name>GROUP_Knowledge Base Consumers</cm:name> <cm:authorityName>GROUP_Knowledge Base Consumers</cm:authorityName> </view:properties> </cm:authorityContainer> <cm:authorityContainer view:childName="cm:GROUP_Knowledge Base Coordinators"> <view:aspects> <sys:referenceable /> </view:aspects> <view:properties> <sys:node-uuid>Knowledge Base Coordinators</sys:node-uuid> <cm:name>GROUP_Knowledge Base Coordinators</cm:name> <cm:authorityName>GROUP_Knowledge Base Coordinators</cm:authorityName> </view:properties> </cm:authorityContainer> </sys:children> </view:associations> </view:reference> <!-- Each group is also part of the AUTH.ALF and APP.DEFAULT zones --> <view:reference view:pathref="${system.zones_container.childname}/cm:AUTH.ALF"> <view:associations> <cm:inZone> <view:reference view:pathref="${system.authorities_container.childname}/cm:GROUP_Knowledge_x0020_Base_x0020_Consumers" view:childName="cm:GROUP_Knowledge Base Consumers" /> </cm:inZone> <cm:inZone> <view:reference view:pathref="${system.authorities_container.childname}/cm:GROUP_Knowledge_x0020_Base_x0020_Coordinators" view:childName="cm:GROUP_Knowledge Base Coordinators" /> </cm:inZone> </view:associations> </view:reference> <view:reference view:pathref="${system.zones_container.childname}/cm:APP.DEFAULT"> <view:associations> <cm:inZone> <view:reference view:pathref="${system.authorities_container.childname}/cm:GROUP_Knowledge_x0020_Base_x0020_Consumers" view:childName="cm:GROUP_Knowledge Base Consumers" /> </cm:inZone> <cm:inZone> <view:reference view:pathref="${system.authorities_container.childname}/cm:GROUP_Knowledge_x0020_Base_x0020_Coordinators" view:childName="cm:GROUP_Knowledge Base Coordinators" /> </cm:inZone> </view:associations> </view:reference> </view:view>
Here we are bootstrapping two groups, one called Knowledge Base Consumers and one called Knowledge Base Coordinators. The last bit of the group bootstrapping adds the groups to different Zones. The AUTH.ALF zone is for authorities defined within Content Services and not synchronized from an external source, such as LDAP. The APP.DEFAULT zone is for person and group nodes to be found by a normal search. We can store this XML file as part of the Repository JAR module extension project in a file name such as import-groups.xml.
The group XML file can be loaded via a Spring bean configuration as follows:
<beanid="org.alfresco.tutorial.bootstrap.patch.groupsLoader"class="org.alfresco.repo.admin.patch.impl.GenericBootstrapPatch"parent="basePatch" > <property name="id"><value>org.alfresco.tutorial.bootstrap.patch.groupsLoader</value></property> <property name="description"><value>org.alfresco.tutorial.bootstrap.patch.groupsLoader.description</value></property> <property name="fixesFromSchema"><value>0</value></property> <property name="fixesToSchema"><value>${version.schema}</value></property> <property name="targetSchema"><value>99999</value></property> <property name="importerBootstrap"> <ref bean="spacesBootstrap" /> </property> <property name="bootstrapView"> <props> <prop key="path">/${alfresco_user_store.system_container.childname}</prop> <prop key="location">alfresco/module/bootstrap-content-repo/bootstrap/import-groups.xml</prop> </props> </property> </bean>