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/HEAD/root@127614 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-06-02 22:24:27 +00:00
parent a6470f588e
commit 010295d84d
2 changed files with 16 additions and 5 deletions

View File

@@ -920,13 +920,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
@@ -936,7 +937,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
} }
@@ -1005,11 +1005,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

@@ -178,6 +178,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