mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
ALF-9441 part of ALF-9151.
potentialmembers.get.js now uses new ScriptAuthorityService.getGroups() method for immediately consistent results. Added new test case. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@29027 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -4,7 +4,7 @@ function main()
|
||||
var siteShortName = url.templateArgs.shortname,
|
||||
site = siteService.getSite(siteShortName),
|
||||
filter = (args.filter != null) ? args.filter : (args.shortNameFilter != null) ? args.shortNameFilter : "",
|
||||
maxResults = (args.maxResults == null) ? 0 : parseInt(args.maxResults, 10),
|
||||
maxResults = (args.maxResults == null) ? 10 : parseInt(args.maxResults, 10),
|
||||
authorityType = args.authorityType,
|
||||
zone = args.zone;
|
||||
|
||||
@@ -20,7 +20,7 @@ function main()
|
||||
var peopleFound = [],
|
||||
groupsFound = [],
|
||||
notAllowed = [],
|
||||
i, ii, name;
|
||||
i, ii, name, paging;
|
||||
|
||||
if (authorityType == null || authorityType == "USER")
|
||||
{
|
||||
@@ -58,7 +58,8 @@ function main()
|
||||
// Get the collection of groups
|
||||
if (zone == null)
|
||||
{
|
||||
groupsFound = groups.searchGroups(filter);
|
||||
paging = utils.createPaging(maxResults, -1);
|
||||
groupsFound = groups.getGroups(filter, paging);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -259,8 +259,8 @@ public class SiteServiceTest extends BaseWebScriptTest
|
||||
|
||||
// Create a site and get it
|
||||
String shortName = GUID.generate();
|
||||
JSONObject result = createSite("myPreset", shortName, "myTitle", "myDescription", SiteVisibility.PUBLIC, 200);
|
||||
Response response = sendRequest(new GetRequest(URL_SITES + "/" + shortName), 200);
|
||||
createSite("myPreset", shortName, "myTitle", "myDescription", SiteVisibility.PUBLIC, 200);
|
||||
sendRequest(new GetRequest(URL_SITES + "/" + shortName), 200);
|
||||
|
||||
}
|
||||
|
||||
@@ -293,20 +293,20 @@ public class SiteServiceTest extends BaseWebScriptTest
|
||||
public void testDeleteSite() throws Exception
|
||||
{
|
||||
// Delete non-existent site
|
||||
Response response = sendRequest(new DeleteRequest(URL_SITES + "/" + "somerandomshortname"), 404);
|
||||
sendRequest(new DeleteRequest(URL_SITES + "/" + "somerandomshortname"), 404);
|
||||
|
||||
// Create a site
|
||||
String shortName = GUID.generate();
|
||||
JSONObject result = createSite("myPreset", shortName, "myTitle", "myDescription", SiteVisibility.PUBLIC, 200);
|
||||
createSite("myPreset", shortName, "myTitle", "myDescription", SiteVisibility.PUBLIC, 200);
|
||||
|
||||
// Get the site
|
||||
response = sendRequest(new GetRequest(URL_SITES + "/" + shortName), 200);
|
||||
sendRequest(new GetRequest(URL_SITES + "/" + shortName), 200);
|
||||
|
||||
// Delete the site
|
||||
response = sendRequest(new DeleteRequest(URL_SITES + "/" + shortName), 200);
|
||||
sendRequest(new DeleteRequest(URL_SITES + "/" + shortName), 200);
|
||||
|
||||
// Get the site
|
||||
response = sendRequest(new GetRequest(URL_SITES + "/" + shortName), 404);
|
||||
sendRequest(new GetRequest(URL_SITES + "/" + shortName), 404);
|
||||
}
|
||||
|
||||
public void testGetMemberships() throws Exception
|
||||
@@ -340,7 +340,6 @@ public class SiteServiceTest extends BaseWebScriptTest
|
||||
|
||||
// Post the membership
|
||||
Response response = sendRequest(new PostRequest(URL_SITES + "/" + shortName + URL_MEMBERSHIPS, membership.toString(), "application/json"), 200);
|
||||
JSONObject result = new JSONObject(response.getContentAsString());
|
||||
|
||||
// Check the result
|
||||
assertEquals(SiteModel.SITE_CONSUMER, membership.get("role"));
|
||||
@@ -572,6 +571,33 @@ public class SiteServiceTest extends BaseWebScriptTest
|
||||
assertEquals(2, result.length());
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 4.0
|
||||
*/
|
||||
public void testGetPotentialMemberships() throws Exception
|
||||
{
|
||||
// Create a site
|
||||
String shortName = GUID.generate();
|
||||
createSite("myPreset", shortName, "myTitle", "myDescription", SiteVisibility.PUBLIC, 200);
|
||||
|
||||
// Check the memberships
|
||||
String filter = "";
|
||||
String authorityType = "GROUP";
|
||||
String url = "/api/sites/" + shortName + "/potentialmembers?filter=" + filter + "&maxResults=10&authorityType=" + authorityType;
|
||||
Response response = sendRequest(new GetRequest(url), 200);
|
||||
final String contentAsString = response.getContentAsString();
|
||||
JSONObject result = new JSONObject(contentAsString);
|
||||
assertNotNull(result);
|
||||
JSONArray people = result.getJSONArray("people");
|
||||
assertNotNull("people array was null", people);
|
||||
|
||||
JSONArray data = result.getJSONArray("data");
|
||||
assertNotNull("data array was null", data);
|
||||
|
||||
// Delete the site
|
||||
sendRequest(new DeleteRequest(URL_SITES + "/" + shortName), 200);
|
||||
}
|
||||
|
||||
public void testSiteCustomProperties()
|
||||
throws Exception
|
||||
{
|
||||
|
Reference in New Issue
Block a user