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