Merged HEAD (5.2) to 5.2.N (5.2.1)

127614 jkaabimofrad: Merged API-STRIKES-BACK (5.2.0) to HEAD (5.2)
      127461 jvonka: Fix RA-1011: REST API create site
      - can't create site with id/shortName = 'true'


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@127721 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2016-06-03 15:19:11 +00:00
parent c96fec3100
commit f3e9c355c3
2 changed files with 16 additions and 5 deletions

View File

@@ -927,13 +927,14 @@ public class SitesImpl implements Sites
} }
String siteId = siteInfo.getShortName(); String siteId = siteInfo.getShortName();
NodeRef siteNodeRef = siteInfo.getNodeRef();
// default false (if not provided) // default false (if not provided)
boolean skipShareSurfConfig = Boolean.valueOf(parameters.getParameter(PARAM_SKIP_SURF_CONFIGURATION)); boolean skipShareSurfConfig = Boolean.valueOf(parameters.getParameter(PARAM_SKIP_SURF_CONFIGURATION));
if (skipShareSurfConfig == false) if (skipShareSurfConfig == false)
{ {
// import default/fixed preset Share surf config // import default/fixed preset Share surf config
importSite(siteId); importSite(siteId, siteNodeRef);
} }
// pre-create doclib // pre-create doclib
@@ -943,7 +944,6 @@ public class SitesImpl implements Sites
boolean skipAddToFavorites = Boolean.valueOf(parameters.getParameter(PARAM_SKIP_ADDTOFAVORITES)); boolean skipAddToFavorites = Boolean.valueOf(parameters.getParameter(PARAM_SKIP_ADDTOFAVORITES));
if (skipAddToFavorites == false) if (skipAddToFavorites == false)
{ {
NodeRef siteNodeRef = siteInfo.getNodeRef();
String personId = AuthenticationUtil.getFullyAuthenticatedUser(); String personId = AuthenticationUtil.getFullyAuthenticatedUser();
favouritesService.addFavourite(personId, siteNodeRef); // ignore result favouritesService.addFavourite(personId, siteNodeRef); // ignore result
} }
@@ -1012,11 +1012,10 @@ public class SitesImpl implements Sites
return site; return site;
} }
private void importSite(final String siteId) private void importSite(final String siteId, final NodeRef siteNodeRef)
{ {
ImportPackageHandler acpHandler = new SiteImportPackageHandler(siteSurfConfig, siteId); ImportPackageHandler acpHandler = new SiteImportPackageHandler(siteSurfConfig, siteId);
Location location = new Location(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); Location location = new Location(siteNodeRef);
location.setPath("/app:company_home/st:sites/cm:" + ISO9075.encode(siteId));
ImporterBinding binding = new ImporterBinding() ImporterBinding binding = new ImporterBinding()
{ {
@Override @Override

View File

@@ -185,6 +185,18 @@ public class TestSites extends EnterpriseTestApi
sitesProxy.createSite(site); sitesProxy.createSite(site);
} }
// test create using site id = "true" (RA-1101)
{
String siteId = "true";
String siteTitle = "string";
String siteDescription = "string";
Site site = new SiteImpl(null, siteId, null, siteTitle, siteDescription, SiteVisibility.PUBLIC.toString(), null, null);
sitesProxy.createSite(site);
}
// -ve tests // -ve tests
{ {
// invalid auth // invalid auth