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:
@@ -246,7 +246,29 @@ public class SandboxServiceImpl implements SandboxService
|
||||
{
|
||||
ParameterCheck.mandatoryString("wpStoreId", wpStoreId);
|
||||
|
||||
return sandboxFactory.listSandboxes(wpStoreId, AuthenticationUtil.getRunAsUser());
|
||||
String currentUser = AuthenticationUtil.getRunAsUser();
|
||||
|
||||
List<SandboxInfo> sbInfos = null;
|
||||
|
||||
if (wpService.isContentManager(wpStoreId, currentUser))
|
||||
{
|
||||
sbInfos = sandboxFactory.listAllSandboxes(wpStoreId);
|
||||
}
|
||||
else
|
||||
{
|
||||
sbInfos = new ArrayList<SandboxInfo>(1);
|
||||
|
||||
SandboxInfo authorSandbox = getAuthorSandbox(wpStoreId, currentUser);
|
||||
|
||||
if (authorSandbox != null)
|
||||
{
|
||||
sbInfos.add(authorSandbox);
|
||||
}
|
||||
|
||||
sbInfos.add(getSandbox(WCMUtil.buildStagingStoreName(wpStoreId))); // get staging sandbox
|
||||
}
|
||||
|
||||
return sbInfos;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -262,7 +284,13 @@ public class SandboxServiceImpl implements SandboxService
|
||||
throw new AccessDeniedException("Only content managers may list sandboxes for '"+userName+"' (web project id: "+wpStoreId+")");
|
||||
}
|
||||
|
||||
return sandboxFactory.listSandboxes(wpStoreId, userName);
|
||||
return AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<List<SandboxInfo>>()
|
||||
{
|
||||
public List<SandboxInfo> doWork() throws Exception
|
||||
{
|
||||
return listSandboxes(wpStoreId);
|
||||
}
|
||||
}, userName);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -273,7 +301,7 @@ public class SandboxServiceImpl implements SandboxService
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
ParameterCheck.mandatory("sandboxType", sandboxType);
|
||||
|
||||
SandboxInfo sbInfo = sandboxFactory.getSandbox(sbStoreId);
|
||||
SandboxInfo sbInfo = getSandbox(sbStoreId);
|
||||
if (sbInfo != null)
|
||||
{
|
||||
return sbInfo.getSandboxType().equals(sandboxType);
|
||||
@@ -288,6 +316,24 @@ public class SandboxServiceImpl implements SandboxService
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
String wpStoreId = WCMUtil.getWebProjectStoreId(sbStoreId);
|
||||
|
||||
// check user has read access to web project (ie. is a web user)
|
||||
if (! wpService.isWebUser(wpStoreId))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! WCMUtil.isStagingStore(sbStoreId))
|
||||
{
|
||||
String currentUser = AuthenticationUtil.getRunAsUser();
|
||||
|
||||
if (! ((WCMUtil.getUserName(sbStoreId).equals(currentUser)) || (wpService.isContentManager(wpStoreId, currentUser))))
|
||||
{
|
||||
throw new AccessDeniedException("Only content managers may get sandbox '"+sbStoreId+"' (web project id: "+wpStoreId+")");
|
||||
}
|
||||
}
|
||||
|
||||
return sandboxFactory.getSandbox(sbStoreId);
|
||||
}
|
||||
|
||||
@@ -310,11 +356,6 @@ public class SandboxServiceImpl implements SandboxService
|
||||
ParameterCheck.mandatoryString("wpStoreId", wpStoreId);
|
||||
ParameterCheck.mandatoryString("userName", userName);
|
||||
|
||||
if (! wpService.isContentManager(wpStoreId))
|
||||
{
|
||||
throw new AccessDeniedException("Only content managers may get author sandbox for '"+userName+"' (web project id: "+wpStoreId+")");
|
||||
}
|
||||
|
||||
return getSandbox(WCMUtil.buildUserMainStoreName(WCMUtil.buildStagingStoreName(wpStoreId), userName));
|
||||
}
|
||||
|
||||
@@ -421,6 +462,10 @@ public class SandboxServiceImpl implements SandboxService
|
||||
ParameterCheck.mandatoryString("dstSandboxStoreId", dstSandboxStoreId);
|
||||
ParameterCheck.mandatoryString("dstRelativePath", dstRelativePath);
|
||||
|
||||
// checks sandbox access (TODO review)
|
||||
getSandbox(srcSandboxStoreId); // ignore result
|
||||
getSandbox(dstSandboxStoreId); // ignore result
|
||||
|
||||
String avmSrcPath = srcSandboxStoreId + WCMUtil.AVM_STORE_SEPARATOR + srcRelativePath;
|
||||
String avmDstPath = dstSandboxStoreId + WCMUtil.AVM_STORE_SEPARATOR + dstRelativePath;
|
||||
|
||||
@@ -567,6 +612,9 @@ public class SandboxServiceImpl implements SandboxService
|
||||
final String submitLabel, final String submitComment,
|
||||
final Map<String, Date> expirationDates, final Date launchDate, final boolean validateLinks, final boolean autoDeploy)
|
||||
{
|
||||
// checks sandbox access (TODO review)
|
||||
getSandbox(sbStoreId); // ignore result
|
||||
|
||||
final String wpStoreId = WCMUtil.getWebProjectStoreId(sbStoreId);
|
||||
final String stagingSandboxId = WCMUtil.buildStagingStoreName(wpStoreId);
|
||||
|
||||
@@ -881,7 +929,7 @@ public class SandboxServiceImpl implements SandboxService
|
||||
|
||||
List<AssetInfo> assets = listChanged(sbStoreId, relativePath, true);
|
||||
|
||||
revertListNodes(sbStoreId, assets);
|
||||
revertListAssets(sbStoreId, assets);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -903,16 +951,19 @@ public class SandboxServiceImpl implements SandboxService
|
||||
}
|
||||
}
|
||||
|
||||
revertListNodes(sbStoreId, assets);
|
||||
revertListAssets(sbStoreId, assets);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#revertListNodes(java.lang.String, java.util.List)
|
||||
* @see org.alfresco.wcm.sandbox.SandboxService#revertListAssets(java.lang.String, java.util.List)
|
||||
*/
|
||||
public void revertListNodes(String sbStoreId, List<AssetInfo> assets)
|
||||
public void revertListAssets(String sbStoreId, List<AssetInfo> assets)
|
||||
{
|
||||
ParameterCheck.mandatoryString("sbStoreId", sbStoreId);
|
||||
|
||||
// checks sandbox access (TODO review)
|
||||
getSandbox(sbStoreId); // ignore result
|
||||
|
||||
List<Pair<Integer, String>> versionPaths = new ArrayList<Pair<Integer, String>>(assets.size());
|
||||
|
||||
List<WorkflowTask> tasks = null;
|
||||
@@ -1072,41 +1123,6 @@ public class SandboxServiceImpl implements SandboxService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively remove locks from a path. Walking child folders looking for files
|
||||
* to remove locks from.
|
||||
*/
|
||||
/*
|
||||
private void recursivelyRemoveLocks(String wpStoreId, int version, AVMNodeDescriptor desc, String absoluteAVMPath)
|
||||
{
|
||||
if (desc.isFile() || desc.isDeletedFile())
|
||||
{
|
||||
avmLockingService.removeLock(wpStoreId, WCMUtil.getStoreRelativePath(absoluteAVMPath));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (desc.isDeletedDirectory())
|
||||
{
|
||||
// lookup the previous child and get its contents
|
||||
final List<AVMNodeDescriptor> history = avmService.getHistory(desc, 2);
|
||||
if (history.size() <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
desc = history.get(1);
|
||||
}
|
||||
|
||||
Map<String, AVMNodeDescriptor> list = avmService.getDirectoryListingDirect(desc, true);
|
||||
for (Map.Entry<String, AVMNodeDescriptor> child : list.entrySet())
|
||||
{
|
||||
String name = child.getKey();
|
||||
AVMNodeDescriptor childDesc = child.getValue();
|
||||
recursivelyRemoveLocks(wpStoreId, version, childDesc, absoluteAVMPath + "/" + name);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create Sandbox Transaction listener - invoked after commit
|
||||
*/
|
||||
|
Reference in New Issue
Block a user