mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V3.1 to HEAD
13077: Abstracted ContentStore MBean operations 13099: Merge V3.0 to V3.1 13096 Merged V2.2 to V3.0 13071: Fix ETWOTWO-1058: Hibernate exception while concurrently submitting from and updating same user sandbox. 13079: Fix ETWOTWO-1117: Misleading exceptions reported during AVM flatten and update 13102: [no comment] 13112: Merged V3.0 to V3.1 13111: Merged V2.2 to V3.0 13110: Fix 2.1 -> 2.2 upgrade on Postgres 13114: Build/test fix (Enterprise Remote API project does not yet have any Java files to generate Javadoc) 13117: DM Index Check - unit test improvements 13123: *RECORD ONLY* Removed svn:mergeinfo fluff 13124: Used newer, more efficient NodeService.addProperties method instead of many NodeService.setProperty calls 13125: Added M2Binding for 'child-association': propagateTimestamps' 13126: WCM unit tests - reduce build/test time to check (async) submits 13127: Minor test fix - to allow it to run locally (on Mac OS X) 13130: Support for 'maxRetries' of zero or less 13131: Merged V3.0 to V3.1 13025 *RECORD-ONLY*: Removed unnecessary svn:mergeinfo 13026: Merged V2.2 to V3.0 12964: Fixed ETWOTWO-968: Space rules are not run when saving from MS Word 12993 *RECORD-ONLY*: added openoffice bootstrap context to sample-extensions 13009 *RECORD-ONLY*: Avoid default OOo config from causing problems on zip/gz installs 13132: Updated svn:mergeinfo 13134: ETHREEOH-1202 - initial fix and unit tests ___________________________________________________________________ Modified: svn:mergeinfo Merged /alfresco/BRANCHES/V3.0:r13005,13025-13026,13030,13039,13042,13050,13053,13096,13098,13111 Merged /alfresco/BRANCHES/V2.2:r12964,12993,13009,13071,13079,13110 Merged /alfresco/BRANCHES/V3.1:r13077,13099,13102,13112,13114,13117,13123-13127,13130-13132,13134 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13564 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -41,34 +41,32 @@ public class AVMPermissionsPatch extends AbstractPatch
|
||||
{
|
||||
|
||||
private static final String MSG_SUCCESS = "patch.updateAvmPermissions.result";
|
||||
|
||||
|
||||
private AccessControlListDAO accessControlListDao;
|
||||
|
||||
private AclDaoComponentImpl aclDaoComponent;
|
||||
|
||||
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
Thread progressThread = null;
|
||||
if (aclDaoComponent.supportsProgressTracking())
|
||||
{
|
||||
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
|
||||
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
|
||||
progressThread = new Thread(new ProgressWatcher(), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
}
|
||||
|
||||
Map<ACLType, Integer> summary = accessControlListDao.patchAcls();
|
||||
|
||||
|
||||
Map<ACLType, Integer> summary = this.accessControlListDao.patchAcls();
|
||||
|
||||
if (progressThread != null)
|
||||
{
|
||||
progressThread.interrupt();
|
||||
progressThread.join();
|
||||
}
|
||||
|
||||
|
||||
// build the result message
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS, summary.get(ACLType.DEFINING), summary.get(ACLType.LAYERED));
|
||||
String msg = I18NUtil.getMessage(AVMPermissionsPatch.MSG_SUCCESS, summary.get(ACLType.DEFINING), summary
|
||||
.get(ACLType.LAYERED));
|
||||
// done
|
||||
return msg;
|
||||
}
|
||||
@@ -82,8 +80,7 @@ public class AVMPermissionsPatch extends AbstractPatch
|
||||
{
|
||||
this.aclDaoComponent = aclDaoComponent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class ProgressWatcher implements Runnable
|
||||
{
|
||||
private boolean running = true;
|
||||
@@ -92,15 +89,9 @@ public class AVMPermissionsPatch extends AbstractPatch
|
||||
|
||||
Long max;
|
||||
|
||||
ProgressWatcher(Long toDo, Long max)
|
||||
{
|
||||
this.toDo = toDo;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
while (running)
|
||||
while (this.running)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -108,27 +99,35 @@ public class AVMPermissionsPatch extends AbstractPatch
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
running = false;
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
if (running)
|
||||
if (this.running)
|
||||
{
|
||||
RetryingTransactionHelper txHelper = transactionService.getRetryingTransactionHelper();
|
||||
RetryingTransactionHelper txHelper = AVMPermissionsPatch.this.transactionService
|
||||
.getRetryingTransactionHelper();
|
||||
txHelper.setMaxRetries(1);
|
||||
Long done = txHelper.doInTransaction(new RetryingTransactionCallback<Long>()
|
||||
{
|
||||
|
||||
public Long execute() throws Throwable
|
||||
{
|
||||
return aclDaoComponent.getAVMNodeCountWithNewACLS(max);
|
||||
if (ProgressWatcher.this.toDo == null)
|
||||
{
|
||||
ProgressWatcher.this.toDo = AVMPermissionsPatch.this.aclDaoComponent
|
||||
.getAVMHeadNodeCount();
|
||||
ProgressWatcher.this.max = AVMPermissionsPatch.this.aclDaoComponent.getMaxAclId();
|
||||
}
|
||||
return AVMPermissionsPatch.this.aclDaoComponent
|
||||
.getAVMNodeCountWithNewACLS(ProgressWatcher.this.max);
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
reportProgress(toDo, done);
|
||||
reportProgress(this.toDo, done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -41,34 +41,31 @@ public class DmPermissionsPatch extends AbstractPatch
|
||||
{
|
||||
|
||||
private static final String MSG_SUCCESS = "patch.updateDmPermissions.result";
|
||||
|
||||
|
||||
private AccessControlListDAO accessControlListDao;
|
||||
|
||||
private AclDaoComponentImpl aclDaoComponent;
|
||||
|
||||
|
||||
@Override
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
Thread progressThread = null;
|
||||
if (aclDaoComponent.supportsProgressTracking())
|
||||
if (this.aclDaoComponent.supportsProgressTracking())
|
||||
{
|
||||
Long toDo = aclDaoComponent.getDmNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
|
||||
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "DMPatchProgressWatcher");
|
||||
progressThread = new Thread(new ProgressWatcher(), "DMPatchProgressWatcher");
|
||||
progressThread.start();
|
||||
}
|
||||
|
||||
Map<ACLType, Integer> summary = accessControlListDao.patchAcls();
|
||||
|
||||
|
||||
Map<ACLType, Integer> summary = this.accessControlListDao.patchAcls();
|
||||
|
||||
if (progressThread != null)
|
||||
{
|
||||
progressThread.interrupt();
|
||||
progressThread.join();
|
||||
}
|
||||
|
||||
|
||||
// build the result message
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS, summary.get(ACLType.DEFINING));
|
||||
String msg = I18NUtil.getMessage(DmPermissionsPatch.MSG_SUCCESS, summary.get(ACLType.DEFINING));
|
||||
// done
|
||||
return msg;
|
||||
}
|
||||
@@ -85,14 +82,14 @@ public class DmPermissionsPatch extends AbstractPatch
|
||||
|
||||
/**
|
||||
* Set the acl dao component
|
||||
*
|
||||
* @param aclDaoComponent
|
||||
*/
|
||||
public void setAclDaoComponent(AclDaoComponentImpl aclDaoComponent)
|
||||
{
|
||||
this.aclDaoComponent = aclDaoComponent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class ProgressWatcher implements Runnable
|
||||
{
|
||||
private boolean running = true;
|
||||
@@ -101,15 +98,9 @@ public class DmPermissionsPatch extends AbstractPatch
|
||||
|
||||
Long max;
|
||||
|
||||
ProgressWatcher(Long toDo, Long max)
|
||||
{
|
||||
this.toDo = toDo;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
while (running)
|
||||
while (this.running)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -117,27 +108,35 @@ public class DmPermissionsPatch extends AbstractPatch
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
running = false;
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
if (running)
|
||||
if (this.running)
|
||||
{
|
||||
RetryingTransactionHelper txHelper = transactionService.getRetryingTransactionHelper();
|
||||
RetryingTransactionHelper txHelper = DmPermissionsPatch.this.transactionService
|
||||
.getRetryingTransactionHelper();
|
||||
txHelper.setMaxRetries(1);
|
||||
Long done = txHelper.doInTransaction(new RetryingTransactionCallback<Long>()
|
||||
{
|
||||
|
||||
public Long execute() throws Throwable
|
||||
{
|
||||
return aclDaoComponent.getDmNodeCountWithNewACLS(max);
|
||||
if (ProgressWatcher.this.toDo == null)
|
||||
{
|
||||
ProgressWatcher.this.toDo = DmPermissionsPatch.this.aclDaoComponent
|
||||
.getDmNodeCount();
|
||||
ProgressWatcher.this.max = DmPermissionsPatch.this.aclDaoComponent.getMaxAclId();
|
||||
}
|
||||
return DmPermissionsPatch.this.aclDaoComponent
|
||||
.getDmNodeCountWithNewACLS(ProgressWatcher.this.max);
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
reportProgress(toDo, done);
|
||||
reportProgress(this.toDo, done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -24,33 +24,25 @@
|
||||
*/
|
||||
package org.alfresco.repo.admin.patch.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.sf.acegisecurity.providers.jaas.AuthorityGranter;
|
||||
|
||||
import org.alfresco.i18n.I18NUtil;
|
||||
import org.alfresco.model.WCMAppModel;
|
||||
import org.alfresco.repo.admin.patch.AbstractPatch;
|
||||
import org.alfresco.repo.avm.AVMNodeConverter;
|
||||
import org.alfresco.repo.avm.AVMRepository;
|
||||
import org.alfresco.repo.domain.PropertyValue;
|
||||
import org.alfresco.repo.domain.hibernate.AclDaoComponentImpl;
|
||||
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor;
|
||||
import org.alfresco.repo.search.AVMSnapShotTriggeredIndexingMethodInterceptor.StoreType;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
|
||||
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
|
||||
import org.alfresco.service.cmr.avm.AVMService;
|
||||
import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.StoreRef;
|
||||
import org.alfresco.service.cmr.security.AccessPermission;
|
||||
import org.alfresco.service.cmr.security.AuthorityService;
|
||||
@@ -58,7 +50,6 @@ import org.alfresco.service.cmr.security.AuthorityType;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
|
||||
/**
|
||||
* Remove ACLs on all but staging area stores On staging area stores, set ACls according to the users and roles as set
|
||||
@@ -68,8 +59,11 @@ import org.alfresco.service.transaction.TransactionService;
|
||||
*/
|
||||
public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
{
|
||||
public static final String[] PERMISSIONS = new String[] { PermissionService.WCM_CONTENT_MANAGER, PermissionService.WCM_CONTENT_PUBLISHER,
|
||||
PermissionService.WCM_CONTENT_CONTRIBUTOR, PermissionService.WCM_CONTENT_REVIEWER };
|
||||
public static final String[] PERMISSIONS = new String[]
|
||||
{
|
||||
PermissionService.WCM_CONTENT_MANAGER, PermissionService.WCM_CONTENT_PUBLISHER,
|
||||
PermissionService.WCM_CONTENT_CONTRIBUTOR, PermissionService.WCM_CONTENT_REVIEWER
|
||||
};
|
||||
|
||||
private static final String MSG_SUCCESS = "patch.moveWCMToGroupBasedPermissionsPatch.result";
|
||||
|
||||
@@ -82,7 +76,7 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
AclDaoComponentImpl aclDaoComponent;
|
||||
|
||||
AuthorityService authorityService;
|
||||
|
||||
|
||||
String replaceAllWith = PermissionService.WCM_CONTENT_MANAGER;
|
||||
|
||||
public void setAvmService(AVMService avmService)
|
||||
@@ -90,7 +84,8 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
|
||||
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(
|
||||
AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
|
||||
{
|
||||
this.avmSnapShotTriggeredIndexingMethodInterceptor = avmSnapShotTriggeredIndexingMethodInterceptor;
|
||||
}
|
||||
@@ -110,8 +105,6 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
this.authorityService = authorityService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setReplaceAllWith(String replaceAllWith)
|
||||
{
|
||||
this.replaceAllWith = replaceAllWith;
|
||||
@@ -121,20 +114,17 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
Thread progressThread = null;
|
||||
if (aclDaoComponent.supportsProgressTracking())
|
||||
if (this.aclDaoComponent.supportsProgressTracking())
|
||||
{
|
||||
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
|
||||
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
|
||||
progressThread = new Thread(new ProgressWatcher(), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
}
|
||||
|
||||
List<AVMStoreDescriptor> stores = avmService.getStores();
|
||||
List<AVMStoreDescriptor> stores = this.avmService.getStores();
|
||||
for (AVMStoreDescriptor store : stores)
|
||||
{
|
||||
|
||||
Map<QName, PropertyValue> storeProperties = avmService.getStoreProperties(store.getName());
|
||||
Map<QName, PropertyValue> storeProperties = this.avmService.getStoreProperties(store.getName());
|
||||
|
||||
switch (StoreType.getStoreType(store.getName(), store, storeProperties))
|
||||
{
|
||||
@@ -174,14 +164,14 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
}
|
||||
|
||||
// build the result message
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS);
|
||||
String msg = I18NUtil.getMessage(MoveWCMToGroupBasedPermissionsPatch.MSG_SUCCESS);
|
||||
// done
|
||||
return msg;
|
||||
}
|
||||
|
||||
private boolean isPermissionSet(NodeRef nodeRef, String authority, String permission)
|
||||
{
|
||||
Set<AccessPermission> set = permissionService.getAllSetPermissions(nodeRef);
|
||||
Set<AccessPermission> set = this.permissionService.getAllSetPermissions(nodeRef);
|
||||
for (AccessPermission ap : set)
|
||||
{
|
||||
if (ap.getAuthority().equals(authority) && ap.isSetDirectly() && ap.getPermission().equals(permission))
|
||||
@@ -194,7 +184,7 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
|
||||
private boolean isMaskSet(StoreRef storeRef, String authority, String permission)
|
||||
{
|
||||
Set<AccessPermission> set = permissionService.getAllSetPermissions(storeRef);
|
||||
Set<AccessPermission> set = this.permissionService.getAllSetPermissions(storeRef);
|
||||
for (AccessPermission ap : set)
|
||||
{
|
||||
if (ap.getAuthority().equals(authority) && ap.isSetDirectly() && ap.getPermission().equals(permission))
|
||||
@@ -207,14 +197,14 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
|
||||
private void makeGroupsIfRequired(String stagingStoreName, NodeRef dirRef)
|
||||
{
|
||||
for (String permission : PERMISSIONS)
|
||||
for (String permission : MoveWCMToGroupBasedPermissionsPatch.PERMISSIONS)
|
||||
{
|
||||
String shortName = stagingStoreName + "-" + permission;
|
||||
String group = authorityService.getName(AuthorityType.GROUP, shortName);
|
||||
if (!authorityService.authorityExists(group))
|
||||
String group = this.authorityService.getName(AuthorityType.GROUP, shortName);
|
||||
if (!this.authorityService.authorityExists(group))
|
||||
{
|
||||
String newGroup = authorityService.createAuthority(AuthorityType.GROUP, null, shortName);
|
||||
permissionService.setPermission(dirRef, newGroup, permission, true);
|
||||
String newGroup = this.authorityService.createAuthority(AuthorityType.GROUP, null, shortName);
|
||||
this.permissionService.setPermission(dirRef, newGroup, permission, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,11 +212,11 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
private void addToGroupIfRequired(String stagingStoreName, String user, String permission)
|
||||
{
|
||||
String shortName = stagingStoreName + "-" + permission;
|
||||
String group = authorityService.getName(AuthorityType.GROUP, shortName);
|
||||
Set<String> members = authorityService.getContainedAuthorities(AuthorityType.USER, group, true);
|
||||
String group = this.authorityService.getName(AuthorityType.GROUP, shortName);
|
||||
Set<String> members = this.authorityService.getContainedAuthorities(AuthorityType.USER, group, true);
|
||||
if (!members.contains(user))
|
||||
{
|
||||
authorityService.addAuthority(group, user);
|
||||
this.authorityService.addAuthority(group, user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,23 +236,24 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
{
|
||||
QName propQName = QName.createQName(null, ".web_project.noderef");
|
||||
|
||||
PropertyValue pValue = avmService.getStoreProperty(stagingStoreName, propQName);
|
||||
PropertyValue pValue = this.avmService.getStoreProperty(stagingStoreName, propQName);
|
||||
|
||||
if (pValue != null)
|
||||
{
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(webProjectNodeRef,
|
||||
WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
String username = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
if (userrole.equals(PermissionService.ALL_PERMISSIONS))
|
||||
{
|
||||
nodeService.setProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE, replaceAllWith);
|
||||
this.nodeService.setProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE, this.replaceAllWith);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -279,35 +270,37 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
|
||||
if (!isPermissionSet(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ))
|
||||
{
|
||||
permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
this.permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ,
|
||||
true);
|
||||
}
|
||||
|
||||
// Add group permissions
|
||||
for (String permission : PERMISSIONS)
|
||||
for (String permission : MoveWCMToGroupBasedPermissionsPatch.PERMISSIONS)
|
||||
{
|
||||
String cms = authorityService.getName(AuthorityType.GROUP, store.getName() + "-" + permission);
|
||||
permissionService.setPermission(dirRef, cms, permission, true);
|
||||
String cms = this.authorityService.getName(AuthorityType.GROUP, store.getName() + "-" + permission);
|
||||
this.permissionService.setPermission(dirRef, cms, permission, true);
|
||||
}
|
||||
|
||||
PropertyValue pValue = avmService.getStoreProperty(store.getName(), propQName);
|
||||
PropertyValue pValue = this.avmService.getStoreProperty(store.getName(), propQName);
|
||||
|
||||
if (pValue != null)
|
||||
{
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(webProjectNodeRef,
|
||||
WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
String username = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
// remove existing
|
||||
|
||||
if (isPermissionSet(dirRef, username, userrole))
|
||||
{
|
||||
permissionService.deletePermission(dirRef, username, userrole);
|
||||
this.permissionService.deletePermission(dirRef, username, userrole);
|
||||
}
|
||||
|
||||
addToGroupIfRequired(store.getName(), username, userrole);
|
||||
@@ -322,35 +315,38 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
|
||||
if (!isMaskSet(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES,
|
||||
PermissionService.READ, true);
|
||||
}
|
||||
|
||||
String cms = authorityService.getName(AuthorityType.GROUP, store.getName() + "-" + PermissionService.WCM_CONTENT_MANAGER);
|
||||
String cms = this.authorityService.getName(AuthorityType.GROUP, store.getName() + "-"
|
||||
+ PermissionService.WCM_CONTENT_MANAGER);
|
||||
if (!isMaskSet(dirRef.getStoreRef(), cms, PermissionService.CHANGE_PERMISSIONS))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), cms, PermissionService.CHANGE_PERMISSIONS, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), cms, PermissionService.CHANGE_PERMISSIONS, true);
|
||||
}
|
||||
|
||||
if (!isMaskSet(dirRef.getStoreRef(), cms, PermissionService.READ_PERMISSIONS))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), cms, PermissionService.READ_PERMISSIONS, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), cms, PermissionService.READ_PERMISSIONS, true);
|
||||
}
|
||||
|
||||
QName propQName = QName.createQName(null, ".web_project.noderef");
|
||||
|
||||
PropertyValue pValue = avmService.getStoreProperty(store.getName(), propQName);
|
||||
PropertyValue pValue = this.avmService.getStoreProperty(store.getName(), propQName);
|
||||
|
||||
if (pValue != null)
|
||||
{
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(webProjectNodeRef,
|
||||
WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
String username = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
if (userrole.equals(PermissionService.WCM_CONTENT_MANAGER))
|
||||
{
|
||||
@@ -358,12 +354,14 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
|
||||
if (isMaskSet(dirRef.getStoreRef(), username, PermissionService.CHANGE_PERMISSIONS))
|
||||
{
|
||||
permissionService.deletePermission(dirRef.getStoreRef(), username, PermissionService.CHANGE_PERMISSIONS);
|
||||
this.permissionService.deletePermission(dirRef.getStoreRef(), username,
|
||||
PermissionService.CHANGE_PERMISSIONS);
|
||||
}
|
||||
|
||||
if (isMaskSet(dirRef.getStoreRef(), username, PermissionService.READ_PERMISSIONS))
|
||||
{
|
||||
permissionService.deletePermission(dirRef.getStoreRef(), username, PermissionService.READ_PERMISSIONS);
|
||||
this.permissionService.deletePermission(dirRef.getStoreRef(), username,
|
||||
PermissionService.READ_PERMISSIONS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -382,18 +380,21 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, sandBoxStore.getName() + ":/www");
|
||||
|
||||
Map<QName, PropertyValue> woof = avmService.getStoreProperties(stagingAreaName);
|
||||
PropertyValue pValue = avmService.getStoreProperty(stagingAreaName, propQName);
|
||||
Map<QName, PropertyValue> woof = this.avmService.getStoreProperties(stagingAreaName);
|
||||
PropertyValue pValue = this.avmService.getStoreProperty(stagingAreaName, propQName);
|
||||
|
||||
if (!isMaskSet(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES,
|
||||
PermissionService.READ, true);
|
||||
}
|
||||
|
||||
String cms = authorityService.getName(AuthorityType.GROUP, stagingAreaName + "-" + PermissionService.WCM_CONTENT_MANAGER);
|
||||
String cms = this.authorityService.getName(AuthorityType.GROUP, stagingAreaName + "-"
|
||||
+ PermissionService.WCM_CONTENT_MANAGER);
|
||||
if (!isMaskSet(dirRef.getStoreRef(), cms, PermissionService.WCM_CONTENT_MANAGER))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), cms, PermissionService.WCM_CONTENT_MANAGER, true);
|
||||
this.permissionService
|
||||
.setPermission(dirRef.getStoreRef(), cms, PermissionService.WCM_CONTENT_MANAGER, true);
|
||||
}
|
||||
|
||||
if (pValue != null)
|
||||
@@ -401,22 +402,24 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(webProjectNodeRef,
|
||||
WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
String username = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
if (username.equals(owner))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.ALL_PERMISSIONS, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), username,
|
||||
PermissionService.ALL_PERMISSIONS, true);
|
||||
}
|
||||
else if (userrole.equals("ContentManager"))
|
||||
{
|
||||
if (isMaskSet(dirRef.getStoreRef(), username, userrole))
|
||||
{
|
||||
permissionService.deletePermission(dirRef.getStoreRef(), username, userrole);
|
||||
this.permissionService.deletePermission(dirRef.getStoreRef(), username, userrole);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,15 +459,13 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
|
||||
Long max;
|
||||
|
||||
ProgressWatcher(Long toDo, Long max)
|
||||
ProgressWatcher()
|
||||
{
|
||||
this.toDo = toDo;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
while (running)
|
||||
while (this.running)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -472,23 +473,32 @@ public class MoveWCMToGroupBasedPermissionsPatch extends AbstractPatch
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
running = false;
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
if (running)
|
||||
if (this.running)
|
||||
{
|
||||
RetryingTransactionHelper txHelper = transactionService.getRetryingTransactionHelper();
|
||||
RetryingTransactionHelper txHelper = MoveWCMToGroupBasedPermissionsPatch.this.transactionService
|
||||
.getRetryingTransactionHelper();
|
||||
txHelper.setMaxRetries(1);
|
||||
Long done = txHelper.doInTransaction(new RetryingTransactionCallback<Long>()
|
||||
{
|
||||
|
||||
public Long execute() throws Throwable
|
||||
{
|
||||
return aclDaoComponent.getAVMNodeCountWithNewACLS(max);
|
||||
if (ProgressWatcher.this.toDo == null)
|
||||
{
|
||||
ProgressWatcher.this.toDo = MoveWCMToGroupBasedPermissionsPatch.this.aclDaoComponent
|
||||
.getAVMHeadNodeCount();
|
||||
ProgressWatcher.this.max = MoveWCMToGroupBasedPermissionsPatch.this.aclDaoComponent
|
||||
.getMaxAclId();
|
||||
}
|
||||
return MoveWCMToGroupBasedPermissionsPatch.this.aclDaoComponent
|
||||
.getAVMNodeCountWithNewACLS(org.alfresco.repo.admin.patch.impl.MoveWCMToGroupBasedPermissionsPatch.ProgressWatcher.this.max);
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
reportProgress(toDo, done);
|
||||
reportProgress(this.toDo, done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,11 +44,9 @@ import org.alfresco.service.cmr.avm.AVMStoreDescriptor;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.security.PermissionService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.service.transaction.TransactionService;
|
||||
|
||||
/**
|
||||
* Remove ACLs on all but staging area stores On staging area stores, set ACls according to the users and roles as set
|
||||
@@ -73,7 +71,8 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
this.avmService = avmService;
|
||||
}
|
||||
|
||||
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
|
||||
public void setAvmSnapShotTriggeredIndexingMethodInterceptor(
|
||||
AVMSnapShotTriggeredIndexingMethodInterceptor avmSnapShotTriggeredIndexingMethodInterceptor)
|
||||
{
|
||||
this.avmSnapShotTriggeredIndexingMethodInterceptor = avmSnapShotTriggeredIndexingMethodInterceptor;
|
||||
}
|
||||
@@ -92,19 +91,16 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
protected String applyInternal() throws Exception
|
||||
{
|
||||
Thread progressThread = null;
|
||||
if (aclDaoComponent.supportsProgressTracking())
|
||||
if (this.aclDaoComponent.supportsProgressTracking())
|
||||
{
|
||||
Long toDo = aclDaoComponent.getAVMHeadNodeCount();
|
||||
Long maxId = aclDaoComponent.getMaxAclId();
|
||||
|
||||
progressThread = new Thread(new ProgressWatcher(toDo, maxId), "WCMPactchProgressWatcher");
|
||||
progressThread = new Thread(new ProgressWatcher(), "WCMPactchProgressWatcher");
|
||||
progressThread.start();
|
||||
}
|
||||
|
||||
List<AVMStoreDescriptor> stores = avmService.getStores();
|
||||
List<AVMStoreDescriptor> stores = this.avmService.getStores();
|
||||
for (AVMStoreDescriptor store : stores)
|
||||
{
|
||||
Map<QName, PropertyValue> storeProperties = avmService.getStoreProperties(store.getName());
|
||||
Map<QName, PropertyValue> storeProperties = this.avmService.getStoreProperties(store.getName());
|
||||
|
||||
switch (StoreType.getStoreType(store.getName(), store, storeProperties))
|
||||
{
|
||||
@@ -145,20 +141,20 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
}
|
||||
|
||||
// build the result message
|
||||
String msg = I18NUtil.getMessage(MSG_SUCCESS);
|
||||
String msg = I18NUtil.getMessage(WCMPermissionPatch.MSG_SUCCESS);
|
||||
// done
|
||||
return msg;
|
||||
}
|
||||
|
||||
private void clearPermissions(AVMStoreDescriptor store)
|
||||
{
|
||||
AVMNodeDescriptor www = avmService.lookup(-1, store.getName() + ":/www");
|
||||
AVMNodeDescriptor www = this.avmService.lookup(-1, store.getName() + ":/www");
|
||||
if (www.isLayeredDirectory() && www.isPrimary())
|
||||
{
|
||||
// throw away any acl
|
||||
AVMRepository.GetInstance().setACL(store.getName() + ":/www", null);
|
||||
// build the default layer acl
|
||||
avmService.retargetLayeredDirectory(store.getName() + ":/www", www.getIndirection());
|
||||
this.avmService.retargetLayeredDirectory(store.getName() + ":/www", www.getIndirection());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,23 +163,24 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
QName propQName = QName.createQName(null, ".web_project.noderef");
|
||||
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, store.getName() + ":/www");
|
||||
permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
this.permissionService.setPermission(dirRef, PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
|
||||
PropertyValue pValue = avmService.getStoreProperty(store.getName(), propQName);
|
||||
PropertyValue pValue = this.avmService.getStoreProperty(store.getName(), propQName);
|
||||
|
||||
if (pValue != null)
|
||||
{
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(webProjectNodeRef,
|
||||
WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
String username = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
permissionService.setPermission(dirRef, username, userrole, true);
|
||||
this.permissionService.setPermission(dirRef, username, userrole, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -191,28 +188,32 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
private void setStagingAreaMasks(AVMStoreDescriptor store)
|
||||
{
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, store.getName() + ":/www");
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES,
|
||||
PermissionService.READ, true);
|
||||
|
||||
QName propQName = QName.createQName(null, ".web_project.noderef");
|
||||
|
||||
PropertyValue pValue = avmService.getStoreProperty(store.getName(), propQName);
|
||||
PropertyValue pValue = this.avmService.getStoreProperty(store.getName(), propQName);
|
||||
|
||||
if (pValue != null)
|
||||
{
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(webProjectNodeRef,
|
||||
WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
String username = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
if (userrole.equals("ContentManager"))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.CHANGE_PERMISSIONS, true);
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.READ_PERMISSIONS, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), username,
|
||||
PermissionService.CHANGE_PERMISSIONS, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), username,
|
||||
PermissionService.READ_PERMISSIONS, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -230,30 +231,33 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
|
||||
NodeRef dirRef = AVMNodeConverter.ToNodeRef(-1, sandBoxStore.getName() + ":/www");
|
||||
|
||||
Map<QName, PropertyValue> woof = avmService.getStoreProperties(stagingAreaName);
|
||||
PropertyValue pValue = avmService.getStoreProperty(stagingAreaName, propQName);
|
||||
this.avmService.getStoreProperties(stagingAreaName);
|
||||
PropertyValue pValue = this.avmService.getStoreProperty(stagingAreaName, propQName);
|
||||
|
||||
permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES, PermissionService.READ, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), PermissionService.ALL_AUTHORITIES,
|
||||
PermissionService.READ, true);
|
||||
|
||||
if (pValue != null)
|
||||
{
|
||||
NodeRef webProjectNodeRef = (NodeRef) pValue.getValue(DataTypeDefinition.NODE_REF);
|
||||
|
||||
// Apply sepcific user permissions as set on the web project
|
||||
List<ChildAssociationRef> userInfoRefs = nodeService.getChildAssocs(webProjectNodeRef, WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
List<ChildAssociationRef> userInfoRefs = this.nodeService.getChildAssocs(webProjectNodeRef,
|
||||
WCMAppModel.ASSOC_WEBUSER, RegexQNamePattern.MATCH_ALL);
|
||||
for (ChildAssociationRef ref : userInfoRefs)
|
||||
{
|
||||
NodeRef userInfoRef = ref.getChildRef();
|
||||
String username = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
String username = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERNAME);
|
||||
String userrole = (String) this.nodeService.getProperty(userInfoRef, WCMAppModel.PROP_WEBUSERROLE);
|
||||
|
||||
if (username.equals(owner))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, PermissionService.ALL_PERMISSIONS, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), username,
|
||||
PermissionService.ALL_PERMISSIONS, true);
|
||||
}
|
||||
else if (userrole.equals("ContentManager"))
|
||||
{
|
||||
permissionService.setPermission(dirRef.getStoreRef(), username, userrole, true);
|
||||
this.permissionService.setPermission(dirRef.getStoreRef(), username, userrole, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -292,15 +296,9 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
|
||||
Long max;
|
||||
|
||||
ProgressWatcher(Long toDo, Long max)
|
||||
{
|
||||
this.toDo = toDo;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public void run()
|
||||
{
|
||||
while (running)
|
||||
while (this.running)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -308,23 +306,31 @@ public class WCMPermissionPatch extends AbstractPatch
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
running = false;
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
if (running)
|
||||
if (this.running)
|
||||
{
|
||||
RetryingTransactionHelper txHelper = transactionService.getRetryingTransactionHelper();
|
||||
RetryingTransactionHelper txHelper = WCMPermissionPatch.this.transactionService
|
||||
.getRetryingTransactionHelper();
|
||||
txHelper.setMaxRetries(1);
|
||||
Long done = txHelper.doInTransaction(new RetryingTransactionCallback<Long>()
|
||||
{
|
||||
|
||||
public Long execute() throws Throwable
|
||||
{
|
||||
return aclDaoComponent.getAVMNodeCountWithNewACLS(max);
|
||||
if (ProgressWatcher.this.toDo == null)
|
||||
{
|
||||
ProgressWatcher.this.toDo = WCMPermissionPatch.this.aclDaoComponent
|
||||
.getAVMHeadNodeCount();
|
||||
ProgressWatcher.this.max = WCMPermissionPatch.this.aclDaoComponent.getMaxAclId();
|
||||
}
|
||||
return WCMPermissionPatch.this.aclDaoComponent
|
||||
.getAVMNodeCountWithNewACLS(ProgressWatcher.this.max);
|
||||
}
|
||||
}, true, true);
|
||||
|
||||
reportProgress(toDo, done);
|
||||
reportProgress(this.toDo, done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user