mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.4-BUG-FIX to HEAD
31987:Proper fix for ALF-11489: 'patch.sitesSpacePermissions' failed on upgrade 2.2.8 -> 3.4.6 - Just handle missing defined ACLs git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@31988 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -435,6 +435,7 @@ patch.nodeTemplatesFolder.description=Patch to create new Data Dictionary folder
|
|||||||
|
|
||||||
patch.sitesSpacePermissions.description=Patch to remove the EVERYONE Contributor permissions on the Sites Space (parent container of all Sites)
|
patch.sitesSpacePermissions.description=Patch to remove the EVERYONE Contributor permissions on the Sites Space (parent container of all Sites)
|
||||||
patch.sitesSpacePermissions.result=Permissions corrected.
|
patch.sitesSpacePermissions.result=Permissions corrected.
|
||||||
|
patch.sitesSpacePermissions.result.none=Permissions corrections not required.
|
||||||
|
|
||||||
patch.updateWorkflowNotificationTemplates.description=Patch to update the workflow notification templates.
|
patch.updateWorkflowNotificationTemplates.description=Patch to update the workflow notification templates.
|
||||||
patch.updateWorkflowNotificationTemplates.result=Workflow Notification Templates successfully updated.
|
patch.updateWorkflowNotificationTemplates.result=Workflow Notification Templates successfully updated.
|
||||||
|
@@ -2918,11 +2918,6 @@
|
|||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>5011</value></property>
|
<property name="fixesToSchema"><value>5011</value></property>
|
||||||
<property name="targetSchema"><value>5012</value></property>
|
<property name="targetSchema"><value>5012</value></property>
|
||||||
<property name="alternatives" >
|
|
||||||
<list>
|
|
||||||
<ref bean="patch.sitesFolder" />
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
<property name="requiresTransaction"><value>false</value></property>
|
<property name="requiresTransaction"><value>false</value></property>
|
||||||
<property name="fileFolderService" ref="fileFolderService" />
|
<property name="fileFolderService" ref="fileFolderService" />
|
||||||
<property name="contentService" ref="contentService" />
|
<property name="contentService" ref="contentService" />
|
||||||
@@ -3044,11 +3039,6 @@
|
|||||||
<property name="fixesFromSchema"><value>0</value></property>
|
<property name="fixesFromSchema"><value>0</value></property>
|
||||||
<property name="fixesToSchema"><value>5017</value></property>
|
<property name="fixesToSchema"><value>5017</value></property>
|
||||||
<property name="targetSchema"><value>5018</value></property>
|
<property name="targetSchema"><value>5018</value></property>
|
||||||
<property name="alternatives" >
|
|
||||||
<list>
|
|
||||||
<ref bean="patch.sitesFolder" />
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
<property name="requiresTransaction"><value>true</value></property>
|
<property name="requiresTransaction"><value>true</value></property>
|
||||||
<property name="applyToTenants"><value>true</value></property>
|
<property name="applyToTenants"><value>true</value></property>
|
||||||
<property name="permissionService" ref="permissionService" />
|
<property name="permissionService" ref="permissionService" />
|
||||||
|
@@ -44,13 +44,13 @@ public class SitesSpacePermissionsPatch extends AbstractPatch
|
|||||||
{
|
{
|
||||||
// Message IDs
|
// Message IDs
|
||||||
private static final String MSG_SUCCESS = "patch.sitesSpacePermissions.result";
|
private static final String MSG_SUCCESS = "patch.sitesSpacePermissions.result";
|
||||||
|
private static final String MSG_SUCCESS_NONE = "patch.sitesSpacePermissions.result.none";
|
||||||
|
|
||||||
// Folders' names for path building
|
// Folders' names for path building
|
||||||
private static final String PROPERTY_COMPANY_HOME_CHILDNAME = "spaces.company_home.childname";
|
private static final String PROPERTY_COMPANY_HOME_CHILDNAME = "spaces.company_home.childname";
|
||||||
private static final String PROPERTY_SITES_CHILDNAME = "spaces.sites.childname";
|
private static final String PROPERTY_SITES_CHILDNAME = "spaces.sites.childname";
|
||||||
|
|
||||||
// Things we've found
|
// Things we've found
|
||||||
private NodeRef companyHomeNodeRef;
|
|
||||||
private NodeRef sitesNodeRef;
|
private NodeRef sitesNodeRef;
|
||||||
|
|
||||||
// Dependencies
|
// Dependencies
|
||||||
@@ -102,27 +102,13 @@ public class SitesSpacePermissionsPatch extends AbstractPatch
|
|||||||
throw new PatchException("Bootstrap property '" + PROPERTY_SITES_CHILDNAME + "' is not present");
|
throw new PatchException("Bootstrap property '" + PROPERTY_SITES_CHILDNAME + "' is not present");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build the search string to get the company home node
|
// build the search string to get the sites node
|
||||||
StringBuilder sb = new StringBuilder(256);
|
StringBuilder sb = new StringBuilder(256);
|
||||||
sb.append("/").append(companyHomeChildName);
|
sb.append("/").append(companyHomeChildName);
|
||||||
String xpath = sb.toString();
|
|
||||||
// get the company home
|
|
||||||
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, xpath, null, namespaceService, false);
|
|
||||||
if (nodeRefs.size() == 0)
|
|
||||||
{
|
|
||||||
throw new PatchException("XPath didn't return any results: \n" + " root: " + storeRootNodeRef + "\n" + " xpath: " + xpath);
|
|
||||||
}
|
|
||||||
else if (nodeRefs.size() > 1)
|
|
||||||
{
|
|
||||||
throw new PatchException("XPath returned too many results: \n" + " root: " + storeRootNodeRef + "\n" + " xpath: " + xpath + "\n" + " results: " + nodeRefs);
|
|
||||||
}
|
|
||||||
this.companyHomeNodeRef = nodeRefs.get(0);
|
|
||||||
|
|
||||||
// build the search string to get the sites node
|
|
||||||
sb.append("/").append(sitesChildName);
|
sb.append("/").append(sitesChildName);
|
||||||
xpath = sb.toString();
|
String xpath = sb.toString();
|
||||||
// get the sites node
|
// get the sites node
|
||||||
nodeRefs = searchService.selectNodes(storeRootNodeRef, xpath, null, namespaceService, false);
|
List<NodeRef> nodeRefs = searchService.selectNodes(storeRootNodeRef, xpath, null, namespaceService, false);
|
||||||
if (nodeRefs.size() == 0)
|
if (nodeRefs.size() == 0)
|
||||||
{
|
{
|
||||||
throw new PatchException("XPath didn't return any results: \n" + " root: " + storeRootNodeRef + "\n" + " xpath: " + xpath);
|
throw new PatchException("XPath didn't return any results: \n" + " root: " + storeRootNodeRef + "\n" + " xpath: " + xpath);
|
||||||
@@ -146,15 +132,28 @@ public class SitesSpacePermissionsPatch extends AbstractPatch
|
|||||||
throw new IllegalStateException("Sites Space not found in Company Home!");
|
throw new IllegalStateException("Sites Space not found in Company Home!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the permission
|
String msg = I18NUtil.getMessage(MSG_SUCCESS);
|
||||||
permissionService.deletePermission(
|
try
|
||||||
sitesSpace,
|
{
|
||||||
PermissionService.ALL_AUTHORITIES,
|
// Remove the permission
|
||||||
PermissionService.CONTRIBUTOR
|
permissionService.deletePermission(
|
||||||
);
|
sitesSpace,
|
||||||
|
PermissionService.ALL_AUTHORITIES,
|
||||||
|
PermissionService.CONTRIBUTOR
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (IllegalStateException e)
|
||||||
|
{
|
||||||
|
if (e.getMessage().contains("SHARED"))
|
||||||
|
{
|
||||||
|
// ALF-11489: 'patch.sitesSpacePermissions' failed on upgrade 2.2.8 -> 3.4.6
|
||||||
|
// We are catching "Can not delete from this acl in a node context SHARED"
|
||||||
|
msg = I18NUtil.getMessage(MSG_SUCCESS_NONE);
|
||||||
|
}
|
||||||
|
// Something else
|
||||||
|
}
|
||||||
|
|
||||||
// All done
|
// All done
|
||||||
String msg = I18NUtil.getMessage(MSG_SUCCESS);
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user