Fixed the completely broken code in memberships.get.js REST API and the equally challenged URL that's calling it in colleagues.get.js.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14570 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2009-06-05 18:47:25 +00:00
parent 6f60cfc4e0
commit 8c84d09566

View File

@@ -16,16 +16,15 @@ function main()
if (authorityType != null) if (authorityType != null)
{ {
authorityType.match("[USER|GROUP]" != null) if (authorityType.match("USER|GROUP") == null)
{ {
status.setCode(status.STATUS_BAD_REQUEST, "The authorityType must be either USER or GROUP."); status.setCode(status.STATUS_BAD_REQUEST, "The 'authorityType' argument must be either USER or GROUP.");
return; return;
} }
} }
// Get the filtered memberships // Get the filtered memberships
// Comes back as a Map<String, String> containing the full authority name // Comes back as a Map<String, String> containing the full authority name and role
// and role
var memberships = site.listMembers(nameFilter, roleFilter, sizeString != null ? parseInt(sizeString) : 0); var memberships = site.listMembers(nameFilter, roleFilter, sizeString != null ? parseInt(sizeString) : 0);
// Get a list of all the users resolved to person nodes // Get a list of all the users resolved to person nodes
@@ -39,8 +38,7 @@ function main()
{ {
if (authorityType == null || authorityType == "GROUP") if (authorityType == null || authorityType == "GROUP")
{ {
// make sure the keys are strings - as usernames may be all // make sure the keys are strings - as usernames may be all numbers!
// numbers!
authorities['_' + userName] = groups.getGroupForFullAuthorityName(userName); authorities['_' + userName] = groups.getGroupForFullAuthorityName(userName);
roles['_' + userName] = membershipRole; roles['_' + userName] = membershipRole;
} }
@@ -49,8 +47,7 @@ function main()
{ {
if (authorityType == null || authorityType == "USER") if (authorityType == null || authorityType == "USER")
{ {
// make sure the keys are strings - as usernames may be all // make sure the keys are strings - as usernames may be all numbers!
// numbers!
authorities['_' + userName] = people.getPerson(userName); authorities['_' + userName] = people.getPerson(userName);
roles['_' + userName] = membershipRole; roles['_' + userName] = membershipRole;
} }