Skip to content
Snippets Groups Projects
Commit 62deb6d2 authored by Jeff Burke's avatar Jeff Burke
Browse files

s1651: changed the group search method back to getGroups

parent 030a4b68
No related branches found
No related tags found
No related merge requests found
......@@ -157,7 +157,7 @@ public abstract interface GroupPersistence<T extends Principal>
* @throws TransientException If an temporary, unexpected problem occurred.
* @throws AccessControlException If the operation is not permitted.
*/
public abstract Collection<Group> searchGroups(T userID, Role role,
public abstract Collection<Group> getGroups(T userID, Role role,
String groupID)
throws UserNotFoundException, GroupNotFoundException,
TransientException, AccessControlException;
......
......@@ -695,7 +695,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO
* @throws UserNotFoundException
* @throws GroupNotFoundException
*/
public Collection<Group> searchGroups(T userID, Role role, String groupID)
public Collection<Group> getGroups(T userID, Role role, String groupID)
throws TransientException, AccessControlException,
GroupNotFoundException, UserNotFoundException
{
......
......@@ -172,7 +172,7 @@ public class LdapGroupPersistence<T extends Principal>
}
}
public Collection<Group> searchGroups(T userID, Role role, String groupID)
public Collection<Group> getGroups(T userID, Role role, String groupID)
throws UserNotFoundException, GroupNotFoundException,
TransientException, AccessControlException
{
......@@ -180,7 +180,7 @@ public class LdapGroupPersistence<T extends Principal>
try
{
groupDAO = new LdapGroupDAO<T>(config, new LdapUserDAO<T>(config));
Collection<Group> ret = groupDAO.searchGroups(userID, role, groupID);
Collection<Group> ret = groupDAO.getGroups(userID, role, groupID);
return ret;
}
finally
......
......@@ -169,13 +169,14 @@ public class ACSearchRunner
RequestValidator rv = new RequestValidator();
rv.validate(job.getParameterList());
Principal userID = AuthenticationUtil.createPrincipal(rv.getUserID(), rv.getIDType().getValue());
//Principal userID = getUserPrincipal(rv.getId(), rv.getType());
Principal userID =
AuthenticationUtil.createPrincipal(rv.getUserID(),
rv.getIDType().getValue());
PluginFactory factory = new PluginFactory();
GroupPersistence dao = factory.getGroupPersistence();
Collection<Group> groups =
dao.searchGroups(userID, rv.getRole(), rv.getGroupID());
dao.getGroups(userID, rv.getRole(), rv.getGroupID());
syncOut.setResponseCode(HttpServletResponse.SC_OK);
GroupsWriter.write(groups, syncOut.getOutputStream());
......
......@@ -258,7 +258,7 @@ public class LdapGroupDAOTest
testGroup = getGroupDAO().addGroup(testGroup);
Collection<Group> groups =
getGroupDAO().searchGroups(daoTestUser1.getUserID(),
getGroupDAO().getGroups(daoTestUser1.getUserID(),
Role.OWNER, null);
boolean found = false;
......@@ -299,25 +299,15 @@ public class LdapGroupDAOTest
{
try
{
Group memberGroup = new Group(getGroupID(), daoTestUser2);
memberGroup = getGroupDAO().addGroup(memberGroup);
log.debug("member group: " + memberGroup.getID());
Group testGroup = new Group(getGroupID(), daoTestUser1);
testGroup.getGroupMembers().add(memberGroup);
testGroup = getGroupDAO().addGroup(testGroup);
log.debug("test group: " + testGroup.getID());
Group expectedGroup = new Group("CadcDaoTestGroup1");
Collection<Group> groups =
getGroupDAO().searchGroups(daoTestUser2.getUserID(),
getGroupDAO().getGroups(daoTestUser2.getUserID(),
Role.MEMBER, null);
log.debug("# groups found: " + groups.size());
boolean found = false;
for (Group group : groups)
{
log.debug("found group: " + group.getID());
if (group.equals(testGroup))
{
log.debug("found test group: " + group.getID());
Set<Group> members = group.getGroupMembers();
......@@ -325,13 +315,12 @@ public class LdapGroupDAOTest
log.debug("#test group members: " + members.size());
for (Group member : members)
{
if (member.equals(memberGroup))
if (member.equals(expectedGroup))
{
found = true;
}
}
}
}
if (!found)
{
fail("Group member not found");
......@@ -357,18 +346,10 @@ public class LdapGroupDAOTest
{
try
{
Group rwGroup = new Group(getGroupID(), daoTestUser2);
rwGroup = getGroupDAO().addGroup(rwGroup);
log.debug("rw group: " + rwGroup.getID());
Group testGroup = new Group(getGroupID(), daoTestUser1);
testGroup.groupRead = rwGroup;
testGroup.groupWrite = rwGroup;
testGroup = getGroupDAO().addGroup(testGroup);
log.debug("test group: " + testGroup.getID());
Group expectedGroup = new Group("CadcDaoTestGroup1");
Collection<Group> groups =
getGroupDAO().searchGroups(daoTestUser2.getUserID(),
getGroupDAO().getGroups(daoTestUser2.getUserID(),
Role.RW, null);
System.out.println("# groups found: " + groups.size());
......@@ -383,7 +364,7 @@ public class LdapGroupDAOTest
{
fail("returned group with wrong owner");
}
if (group.getID().equals(testGroup.getID()))
if (group.equals(expectedGroup))
{
found = true;
}
......@@ -612,7 +593,7 @@ public class LdapGroupDAOTest
try
{
getGroupDAO().searchGroups(unknownPrincipal, Role.OWNER,
getGroupDAO().getGroups(unknownPrincipal, Role.OWNER,
groupID);
fail("searchGroups with unknown user should throw " +
"UserNotFoundException");
......@@ -621,7 +602,7 @@ public class LdapGroupDAOTest
try
{
getGroupDAO().searchGroups(daoTestPrincipal1, Role.OWNER,
getGroupDAO().getGroups(daoTestPrincipal1, Role.OWNER,
"foo");
fail("searchGroups with unknown user should throw " +
"GroupNotFoundException");
......@@ -637,7 +618,7 @@ public class LdapGroupDAOTest
{
try
{
getGroupDAO().searchGroups(daoTestPrincipal1, Role.OWNER,
getGroupDAO().getGroups(daoTestPrincipal1, Role.OWNER,
groupID);
fail("searchGroups with anonymous access should throw " +
"AccessControlException");
......
......@@ -156,16 +156,6 @@ public class GMSClient
}
}
/**
* Get a list of groups.
*
* @return The list of groups.
*/
public List<Group> getGroups()
{
throw new UnsupportedOperationException("Not yet implemented");
}
/**
* Create a new group
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment