diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.config.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.config.xml
new file mode 100644
index 0000000000..f6b9a7a5d4
--- /dev/null
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.config.xml
@@ -0,0 +1,5 @@
+
+
+ true
+ false
+
\ No newline at end of file
diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js b/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js
index 2a9ecc5883..a60e21613c 100644
--- a/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js
+++ b/config/alfresco/templates/webscripts/org/alfresco/repository/upload/upload.post.js
@@ -55,6 +55,10 @@ function main()
utils.setLocale(args["lang"]);
}
+ var uploadConfig = new XML(config.script),
+ autoVersion = uploadConfig.autoVersion.toString() == "" ? null : uploadConfig.autoVersion.toString() == "true",
+ autoVersionProps = uploadConfig.autoVersionProps.toString() == "" ? null : uploadConfig.autoVersionProps.toString() == "true";
+
// Parse file attributes
for each (field in formdata.fields)
{
@@ -229,8 +233,15 @@ function main()
if (!workingcopy)
{
- // Ensure the file is versionable (autoVersion = true, autoVersionProps = false)
- updateNode.ensureVersioningEnabled(true, false);
+ // Ensure the file is versionable (autoVersion and autoVersionProps read from config)
+ if (autoVersion != null && autoVersionProps != null)
+ {
+ updateNode.ensureVersioningEnabled(autoVersion, autoVersionProps);
+ }
+ else
+ {
+ updateNode.ensureVersioningEnabled();
+ }
// It's not a working copy, do a check out to get the actual working copy
updateNode = updateNode.checkoutForUpload();
@@ -362,8 +373,15 @@ function main()
newFile.save();
// TODO (THOR-175) - review
- // Ensure the file is versionable (autoVersion = true, autoVersionProps = false)
- newFile.ensureVersioningEnabled(true, false);
+ // Ensure the file is versionable (autoVersion and autoVersionProps read from config)
+ if (autoVersion != null && autoVersionProps != null)
+ {
+ newFile.ensureVersioningEnabled(autoVersion, autoVersionProps);
+ }
+ else
+ {
+ newFile.ensureVersioningEnabled();
+ }
// NOTE: Removal of first request for thumbnails to improve upload performance
// Thumbnails are still requested by Share on first render of the doclist image.
diff --git a/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java b/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java
index 9f0e002c6f..65858abd46 100644
--- a/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java
+++ b/source/test-java/org/alfresco/rest/api/tests/TestCMIS.java
@@ -61,6 +61,7 @@ import org.alfresco.repo.tenant.TenantService;
import org.alfresco.repo.tenant.TenantUtil;
import org.alfresco.repo.tenant.TenantUtil.TenantRunAsWork;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
+import org.alfresco.repo.version.VersionableAspect;
import org.alfresco.rest.api.tests.RepoService.SiteInformation;
import org.alfresco.rest.api.tests.RepoService.TestNetwork;
import org.alfresco.rest.api.tests.RepoService.TestPerson;
@@ -122,6 +123,7 @@ import org.apache.chemistry.opencmis.commons.exceptions.CmisUpdateConflictExcept
import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.io.IOUtils;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
@@ -155,6 +157,7 @@ public class TestCMIS extends EnterpriseTestApi
private CMISStrictDictionaryService cmisDictionary;
private QNameFilter cmisTypeExclusions;
private NodeService nodeService;
+ private VersionableAspect versionableAspect;
@Before
public void before() throws Exception
@@ -166,6 +169,15 @@ public class TestCMIS extends EnterpriseTestApi
this.cmisDictionary = (CMISStrictDictionaryService)ctx.getBean("OpenCMISDictionaryService");
this.cmisTypeExclusions = (QNameFilter)ctx.getBean("cmisTypeExclusions");
this.nodeService = (NodeService) ctx.getBean("NodeService");
+
+ this.versionableAspect = (VersionableAspect) ctx.getBean("versionableAspect");
+ this.versionableAspect.setEnableAutoVersionOnUpdateProps(true);
+ }
+
+ @After
+ public void after()
+ {
+ this.versionableAspect.setEnableAutoVersionOnUpdateProps(false);
}
private void checkSecondaryTypes(Document doc, Set expectedSecondaryTypes, Set expectedMissingSecondaryTypes)