mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged HEAD-BUG-FIX (4.3/Cloud) to HEAD (4.3/Cloud)
64403: Merged WAT1 (4.3/Cloud) to HEAD-BUG-FIX (4.3/Cloud) 61444: ACE-563: Added SITE_ADMINISTRATORS group as well as a patch. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@64549 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -33,6 +33,16 @@
|
|||||||
<cm:authorityName>GROUP_EMAIL_CONTRIBUTORS</cm:authorityName>
|
<cm:authorityName>GROUP_EMAIL_CONTRIBUTORS</cm:authorityName>
|
||||||
</view:properties>
|
</view:properties>
|
||||||
</cm:authorityContainer>
|
</cm:authorityContainer>
|
||||||
|
<cm:authorityContainer view:childName="cm:GROUP_SITE_ADMINISTRATORS">
|
||||||
|
<view:aspects>
|
||||||
|
<sys:referenceable />
|
||||||
|
</view:aspects>
|
||||||
|
<view:properties>
|
||||||
|
<sys:node-uuid>GROUP_SITE_ADMINISTRATORS</sys:node-uuid>
|
||||||
|
<cm:name>GROUP_SITE_ADMINISTRATORS</cm:name>
|
||||||
|
<cm:authorityName>GROUP_SITE_ADMINISTRATORS</cm:authorityName>
|
||||||
|
</view:properties>
|
||||||
|
</cm:authorityContainer>
|
||||||
</sys:children>
|
</sys:children>
|
||||||
</view:associations>
|
</view:associations>
|
||||||
</sys:container>
|
</sys:container>
|
||||||
@@ -65,6 +75,11 @@
|
|||||||
view:pathref="${system.authorities_container.childname}/cm:GROUP_EMAIL_CONTRIBUTORS"
|
view:pathref="${system.authorities_container.childname}/cm:GROUP_EMAIL_CONTRIBUTORS"
|
||||||
view:childName="cm:GROUP_EMAIL_CONTRIBUTORS" />
|
view:childName="cm:GROUP_EMAIL_CONTRIBUTORS" />
|
||||||
</cm:inZone>
|
</cm:inZone>
|
||||||
|
<cm:inZone>
|
||||||
|
<view:reference
|
||||||
|
view:pathref="${system.authorities_container.childname}/cm:GROUP_SITE_ADMINISTRATORS"
|
||||||
|
view:childName="cm:GROUP_SITE_ADMINISTRATORS" />
|
||||||
|
</cm:inZone>
|
||||||
</view:associations>
|
</view:associations>
|
||||||
</cm:zone>
|
</cm:zone>
|
||||||
<cm:zone view:childName="cm:APP.DEFAULT">
|
<cm:zone view:childName="cm:APP.DEFAULT">
|
||||||
@@ -86,6 +101,11 @@
|
|||||||
view:pathref="${system.authorities_container.childname}/cm:GROUP_EMAIL_CONTRIBUTORS"
|
view:pathref="${system.authorities_container.childname}/cm:GROUP_EMAIL_CONTRIBUTORS"
|
||||||
view:childName="cm:GROUP_EMAIL_CONTRIBUTORS" />
|
view:childName="cm:GROUP_EMAIL_CONTRIBUTORS" />
|
||||||
</cm:inZone>
|
</cm:inZone>
|
||||||
|
<cm:inZone>
|
||||||
|
<view:reference
|
||||||
|
view:pathref="${system.authorities_container.childname}/cm:GROUP_SITE_ADMINISTRATORS"
|
||||||
|
view:childName="cm:GROUP_SITE_ADMINISTRATORS" />
|
||||||
|
</cm:inZone>
|
||||||
</view:associations>
|
</view:associations>
|
||||||
</cm:zone>
|
</cm:zone>
|
||||||
</sys:children>
|
</sys:children>
|
||||||
|
@@ -17,6 +17,14 @@
|
|||||||
</cm:member>
|
</cm:member>
|
||||||
</view:associations>
|
</view:associations>
|
||||||
</view:reference>
|
</view:reference>
|
||||||
|
<view:reference view:pathref="${system.authorities_container.childname}/cm:GROUP_SITE_ADMINISTRATORS">
|
||||||
|
<view:associations>
|
||||||
|
<cm:member>
|
||||||
|
<view:reference view:pathref="${system.people_container.childname}/cm:${alfresco_user_store.adminusername}"
|
||||||
|
view:childName="cm:${alfresco_user_store.adminusername}" />
|
||||||
|
</cm:member>
|
||||||
|
</view:associations>
|
||||||
|
</view:reference>
|
||||||
<view:reference view:pathref="${system.zones_container.childname}/cm:AUTH.ALF">
|
<view:reference view:pathref="${system.zones_container.childname}/cm:AUTH.ALF">
|
||||||
<view:associations>
|
<view:associations>
|
||||||
<cm:inZone>
|
<cm:inZone>
|
||||||
|
@@ -509,3 +509,8 @@ patch.upgradeToActiviti5-13.description=Upgraded Activiti tables to 5.13 version
|
|||||||
|
|
||||||
patch.emailAliasableAspect.description=Add email aliases to attrubute table
|
patch.emailAliasableAspect.description=Add email aliases to attrubute table
|
||||||
patch.emailAliasableAspect.result=Added email aliases to attribute table
|
patch.emailAliasableAspect.result=Added email aliases to attribute table
|
||||||
|
|
||||||
|
patch.addGroupAuthority.start=Adding group authority.
|
||||||
|
patch.addGroupAuthority.result=\n\Successfully added group authority: {0}
|
||||||
|
|
||||||
|
patch.siteAdministrators.description=Adds the 'GROUP_SITE_ADMINISTRATORS' group
|
||||||
|
@@ -3677,4 +3677,39 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="patch.siteAdministrators" class="org.alfresco.repo.admin.patch.impl.AddGroupAuthorityPatch" parent="basePatch" >
|
||||||
|
<property name="id"><value>patch.siteAdministrators</value></property>
|
||||||
|
<property name="description"><value>patch.siteAdministrators.description</value></property>
|
||||||
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
|
<property name="fixesToSchema"><value>7002</value></property>
|
||||||
|
<property name="targetSchema"><value>7003</value></property>
|
||||||
|
<property name="dependsOn" >
|
||||||
|
<list>
|
||||||
|
<ref bean="patch.updateDmPermissions" />
|
||||||
|
</list>
|
||||||
|
</property>
|
||||||
|
<property name="authorityService">
|
||||||
|
<ref bean="authorityService" />
|
||||||
|
</property>
|
||||||
|
<property name="groupAuthorityDetails" >
|
||||||
|
<bean class="org.alfresco.repo.admin.patch.impl.AddGroupAuthorityPatch$GroupAuthorityDetails">
|
||||||
|
<property name="groupName">
|
||||||
|
<value>SITE_ADMINISTRATORS</value>
|
||||||
|
</property>
|
||||||
|
<property name="groupDisplayName">
|
||||||
|
<value>SITE_ADMINISTRATORS</value>
|
||||||
|
</property>
|
||||||
|
<property name="adminUserName">
|
||||||
|
<value>${alfresco_user_store.adminusername}</value>
|
||||||
|
</property>
|
||||||
|
<property name="authorityZones">
|
||||||
|
<set>
|
||||||
|
<value>APP.DEFAULT</value>
|
||||||
|
<value>AUTH.ALF</value>
|
||||||
|
</set>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
</property>
|
||||||
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
@@ -23,4 +23,4 @@ version.build=r@scm-revision@-b@build-number@
|
|||||||
|
|
||||||
# Schema number
|
# Schema number
|
||||||
|
|
||||||
version.schema=7002
|
version.schema=7003
|
||||||
|
@@ -0,0 +1,120 @@
|
|||||||
|
|
||||||
|
package org.alfresco.repo.admin.patch.impl;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityService;
|
||||||
|
import org.alfresco.service.cmr.security.AuthorityType;
|
||||||
|
import org.springframework.extensions.surf.util.I18NUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A patch to add a new group authority.
|
||||||
|
*
|
||||||
|
* @author Jamal Kaabi-Mofrad
|
||||||
|
*/
|
||||||
|
public class AddGroupAuthorityPatch extends AbstractPatch
|
||||||
|
{
|
||||||
|
private static final String MSG_START = "patch.addGroupAuthority.start";
|
||||||
|
private static final String MSG_RESULT = "patch.addGroupAuthority.result";
|
||||||
|
|
||||||
|
private AuthorityService authorityService;
|
||||||
|
private GroupAuthorityDetails groupAuthorityDetails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the authority service.
|
||||||
|
*
|
||||||
|
* @param authorityService the authority service
|
||||||
|
*/
|
||||||
|
public void setAuthorityService(AuthorityService authorityService)
|
||||||
|
{
|
||||||
|
this.authorityService = authorityService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the group authority details.
|
||||||
|
*
|
||||||
|
* @param groupAuthorityDetails the groupAuthorityDetails
|
||||||
|
*/
|
||||||
|
public void setGroupAuthorityDetails(GroupAuthorityDetails groupAuthorityDetails)
|
||||||
|
{
|
||||||
|
this.groupAuthorityDetails = groupAuthorityDetails;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkProperties()
|
||||||
|
{
|
||||||
|
super.checkProperties();
|
||||||
|
checkPropertyNotNull(authorityService, "authorityService");
|
||||||
|
checkPropertyNotNull(groupAuthorityDetails, "groupAuthorityDetails");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String applyInternal() throws Exception
|
||||||
|
{
|
||||||
|
StringBuilder result = new StringBuilder(I18NUtil.getMessage(MSG_START));
|
||||||
|
|
||||||
|
String groupAuthorityName = authorityService.createAuthority(AuthorityType.GROUP,
|
||||||
|
this.groupAuthorityDetails.groupName,
|
||||||
|
this.groupAuthorityDetails.groupDisplayName,
|
||||||
|
this.groupAuthorityDetails.authorityZones);
|
||||||
|
|
||||||
|
if (this.groupAuthorityDetails.adminUserName != null
|
||||||
|
&& authorityService.isAdminAuthority(this.groupAuthorityDetails.adminUserName))
|
||||||
|
{
|
||||||
|
// Add admin as a member of the created group
|
||||||
|
authorityService.addAuthority(groupAuthorityName,
|
||||||
|
this.groupAuthorityDetails.adminUserName);
|
||||||
|
}
|
||||||
|
result.append(I18NUtil.getMessage(MSG_RESULT, groupAuthorityName));
|
||||||
|
|
||||||
|
return result.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple POJO to encapsulate the group authority details.
|
||||||
|
*
|
||||||
|
* @author Jamal Kaabi-Mofrad
|
||||||
|
*/
|
||||||
|
public static class GroupAuthorityDetails
|
||||||
|
{
|
||||||
|
private String groupName;
|
||||||
|
private String groupDisplayName;
|
||||||
|
private String adminUserName;
|
||||||
|
private Set<String> authorityZones;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param groupName the groupName to set
|
||||||
|
*/
|
||||||
|
public void setGroupName(String groupName)
|
||||||
|
{
|
||||||
|
this.groupName = groupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param groupDisplayName the groupDisplayName to set
|
||||||
|
*/
|
||||||
|
public void setGroupDisplayName(String groupDisplayName)
|
||||||
|
{
|
||||||
|
this.groupDisplayName = groupDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Admin's username, so it can be included as a member of the
|
||||||
|
* group. If null, an empty group will be created.
|
||||||
|
*
|
||||||
|
* @param adminUserName the adminUserName to set
|
||||||
|
*/
|
||||||
|
public void setAdminUserName(String adminUserName)
|
||||||
|
{
|
||||||
|
this.adminUserName = adminUserName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param authorityZones the authorityZones to set
|
||||||
|
*/
|
||||||
|
public void setAuthorityZones(Set<String> authorityZones)
|
||||||
|
{
|
||||||
|
this.authorityZones = authorityZones;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -95,7 +95,8 @@ public class AuthorityServiceTest extends TestCase
|
|||||||
|
|
||||||
private static final int DEFAULT_SITE_GRP_CNT = 5; // default number of groups per site
|
private static final int DEFAULT_SITE_GRP_CNT = 5; // default number of groups per site
|
||||||
private static final int DEFAULT_SITE_ROOT_GRP_CNT = 1; // default number of root groups per site
|
private static final int DEFAULT_SITE_ROOT_GRP_CNT = 1; // default number of root groups per site
|
||||||
private static final int DEFAULT_GRP_CNT = 2; // default (non-site) bootstrap groups - eg. GROUP_ALFRESCO_ADMINISTRATORS, GROUP_EMAIL_CONTRIBUTORS
|
private static final int DEFAULT_GRP_CNT = 3; // default (non-site) bootstrap groups -
|
||||||
|
// eg. GROUP_ALFRESCO_ADMINISTRATORS, GROUP_EMAIL_CONTRIBUTORS, GROUP_SITE_ADMINISTRATORS
|
||||||
|
|
||||||
private int SITE_CNT = 0;
|
private int SITE_CNT = 0;
|
||||||
private int GRP_CNT = 0;
|
private int GRP_CNT = 0;
|
||||||
@@ -430,7 +431,7 @@ public class AuthorityServiceTest extends TestCase
|
|||||||
assertTrue(authorityService.hasAdminAuthority());
|
assertTrue(authorityService.hasAdminAuthority());
|
||||||
assertTrue(pubAuthorityService.hasAdminAuthority());
|
assertTrue(pubAuthorityService.hasAdminAuthority());
|
||||||
Set<String> authorities = authorityService.getAuthorities();
|
Set<String> authorities = authorityService.getAuthorities();
|
||||||
assertEquals("Unexpected result: " + authorities, 4 + (SITE_CNT*2), authorityService.getAuthorities().size());
|
assertEquals("Unexpected result: " + authorities, 4 + (SITE_CNT*3), authorityService.getAuthorities().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testNoUser()
|
public void testNoUser()
|
||||||
|
Reference in New Issue
Block a user