Loading projects/cadcAccessControl-Server/build.xml +1 −2 Original line number Diff line number Diff line Loading @@ -148,8 +148,7 @@ <pathelement path="${jars}:${testingJars}"/> </classpath> <sysproperty key="ca.nrc.cadc.util.PropertiesReader.dir" value="test"/> <test name="ca.nrc.cadc.ac.server.ldap.LdapUserDAOTest" /> <test name="ca.nrc.cadc.ac.server.ldap.LdapGroupDAOTest" /> <test name="ca.nrc.cadc.ac.server.web.users.GetUserListActionTest" /> <formatter type="plain" usefile="false" /> </junit> </target> Loading projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/GroupPersistence.java +8 −29 Original line number Diff line number Diff line Loading @@ -72,8 +72,6 @@ import java.security.AccessControlException; import java.security.Principal; import java.util.Collection; import com.unboundid.ldap.sdk.DN; import ca.nrc.cadc.ac.Group; import ca.nrc.cadc.ac.GroupAlreadyExistsException; import ca.nrc.cadc.ac.GroupNotFoundException; Loading @@ -81,7 +79,7 @@ import ca.nrc.cadc.ac.Role; import ca.nrc.cadc.ac.UserNotFoundException; import ca.nrc.cadc.net.TransientException; public abstract interface GroupPersistence<T extends Principal> public interface GroupPersistence<T extends Principal> { /** * Get all group names. Loading @@ -90,7 +88,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 Collection<String> getGroupNames() Collection<String> getGroupNames() throws TransientException, AccessControlException; /** Loading @@ -104,28 +102,10 @@ 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 Group getGroup(String groupID) Group getGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; /** * Get all groups the user, specified by userID, belongs to. * * @param userID The userID. * @param isAdmin return only admin Groups when true, else return non-admin * Groups. * * @return Collection of group DN. * * @throws UserNotFoundException when the user is not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ Collection<DN> getUserGroups(T userID, boolean isAdmin) throws UserNotFoundException, TransientException, AccessControlException; /** * Creates the group. * Loading @@ -141,7 +121,7 @@ public abstract interface GroupPersistence<T extends Principal> * @throws GroupNotFoundException if one of the groups in group members or * group admins does not exist in the server. */ public abstract Group addGroup(Group group) Group addGroup(Group group) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException, GroupNotFoundException; Loading @@ -155,7 +135,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 void deleteGroup(String groupID) void deleteGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; Loading @@ -171,7 +151,7 @@ public abstract interface GroupPersistence<T extends Principal> * @throws AccessControlException If the operation is not permitted. * @throws UserNotFoundException If owner or group members not valid users. */ public abstract Group modifyGroup(Group group) Group modifyGroup(Group group) throws GroupNotFoundException, TransientException, AccessControlException, UserNotFoundException; Loading @@ -190,8 +170,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> getGroups(T userID, Role role, String groupID) Collection<Group> getGroups(T userID, Role role, String groupID) throws UserNotFoundException, GroupNotFoundException, TransientException, AccessControlException; Loading @@ -207,7 +186,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 boolean isMember(T userID, String groupID) boolean isMember(T userID, String groupID) throws UserNotFoundException, TransientException, AccessControlException; Loading projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapGroupDAO.java +7 −7 Original line number Diff line number Diff line Loading @@ -311,7 +311,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO { final Filter filter = Filter.createPresenceFilter("cn"); final String [] attributes = new String[] {"cn", "nsaccountlock"}; final List<String> groupNames = new ArrayList<String>(); final Collection<String> groupNames = new ArrayList<String>(); final long begin = System.currentTimeMillis(); final SearchResult searchResult = Loading Loading @@ -472,7 +472,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO User<X500Principal> owner; try { owner = userPersist.getMember(groupOwner); owner = userPersist.getX500User(groupOwner); } catch (UserNotFoundException e) { Loading Loading @@ -504,7 +504,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO User<X500Principal> user; try { user = userPersist.getMember(memberDN); user = userPersist.getX500User(memberDN); } catch (UserNotFoundException e) { Loading Loading @@ -972,7 +972,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO } Group group = new Group(searchResult.getAttributeValue("cn"), userPersist.getMember( userPersist.getX500User( new DN(searchResult.getAttributeValue( "owner")))); group.description = searchResult.getAttributeValue("description"); Loading Loading @@ -1076,7 +1076,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO try { User<X500Principal> subjectUser = userPersist.getMember(getSubjectDN()); userPersist.getX500User(getSubjectDN()); if (subjectUser.equals(owner)) { return true; Loading projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapGroupPersistence.java +0 −10 Original line number Diff line number Diff line Loading @@ -74,8 +74,6 @@ import java.util.Collection; import org.apache.log4j.Logger; import com.unboundid.ldap.sdk.DN; import ca.nrc.cadc.ac.Group; import ca.nrc.cadc.ac.GroupAlreadyExistsException; import ca.nrc.cadc.ac.GroupNotFoundException; Loading Loading @@ -147,14 +145,6 @@ public class LdapGroupPersistence<T extends Principal> } } public Collection<DN> getUserGroups(T userID, boolean isAdmin) throws UserNotFoundException, TransientException, AccessControlException { return (new LdapUserPersistence<T>()).getUserGroups(userID, isAdmin); } public Group addGroup(Group group) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException, Loading projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java +3 −3 Original line number Diff line number Diff line Loading @@ -359,8 +359,8 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO .getName()); addAttribute(attributes, LDAP_DISTINGUISHED_NAME, userDN .toNormalizedString()); addAttribute(attributes, LADP_USER_PASSWORD, userRequest .getPassword()); addAttribute(attributes, LADP_USER_PASSWORD, String.valueOf(userRequest.getPassword())); for (UserDetails details : user.details) { Loading Loading @@ -831,7 +831,7 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO * @throws UserNotFoundException * @throws LDAPException */ User<X500Principal> getMember(DN userDN) User<X500Principal> getX500User(DN userDN) throws UserNotFoundException, LDAPException { Filter filter = Loading Loading
projects/cadcAccessControl-Server/build.xml +1 −2 Original line number Diff line number Diff line Loading @@ -148,8 +148,7 @@ <pathelement path="${jars}:${testingJars}"/> </classpath> <sysproperty key="ca.nrc.cadc.util.PropertiesReader.dir" value="test"/> <test name="ca.nrc.cadc.ac.server.ldap.LdapUserDAOTest" /> <test name="ca.nrc.cadc.ac.server.ldap.LdapGroupDAOTest" /> <test name="ca.nrc.cadc.ac.server.web.users.GetUserListActionTest" /> <formatter type="plain" usefile="false" /> </junit> </target> Loading
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/GroupPersistence.java +8 −29 Original line number Diff line number Diff line Loading @@ -72,8 +72,6 @@ import java.security.AccessControlException; import java.security.Principal; import java.util.Collection; import com.unboundid.ldap.sdk.DN; import ca.nrc.cadc.ac.Group; import ca.nrc.cadc.ac.GroupAlreadyExistsException; import ca.nrc.cadc.ac.GroupNotFoundException; Loading @@ -81,7 +79,7 @@ import ca.nrc.cadc.ac.Role; import ca.nrc.cadc.ac.UserNotFoundException; import ca.nrc.cadc.net.TransientException; public abstract interface GroupPersistence<T extends Principal> public interface GroupPersistence<T extends Principal> { /** * Get all group names. Loading @@ -90,7 +88,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 Collection<String> getGroupNames() Collection<String> getGroupNames() throws TransientException, AccessControlException; /** Loading @@ -104,28 +102,10 @@ 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 Group getGroup(String groupID) Group getGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; /** * Get all groups the user, specified by userID, belongs to. * * @param userID The userID. * @param isAdmin return only admin Groups when true, else return non-admin * Groups. * * @return Collection of group DN. * * @throws UserNotFoundException when the user is not found. * @throws TransientException If an temporary, unexpected problem occurred. * @throws AccessControlException If the operation is not permitted. */ Collection<DN> getUserGroups(T userID, boolean isAdmin) throws UserNotFoundException, TransientException, AccessControlException; /** * Creates the group. * Loading @@ -141,7 +121,7 @@ public abstract interface GroupPersistence<T extends Principal> * @throws GroupNotFoundException if one of the groups in group members or * group admins does not exist in the server. */ public abstract Group addGroup(Group group) Group addGroup(Group group) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException, GroupNotFoundException; Loading @@ -155,7 +135,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 void deleteGroup(String groupID) void deleteGroup(String groupID) throws GroupNotFoundException, TransientException, AccessControlException; Loading @@ -171,7 +151,7 @@ public abstract interface GroupPersistence<T extends Principal> * @throws AccessControlException If the operation is not permitted. * @throws UserNotFoundException If owner or group members not valid users. */ public abstract Group modifyGroup(Group group) Group modifyGroup(Group group) throws GroupNotFoundException, TransientException, AccessControlException, UserNotFoundException; Loading @@ -190,8 +170,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> getGroups(T userID, Role role, String groupID) Collection<Group> getGroups(T userID, Role role, String groupID) throws UserNotFoundException, GroupNotFoundException, TransientException, AccessControlException; Loading @@ -207,7 +186,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 boolean isMember(T userID, String groupID) boolean isMember(T userID, String groupID) throws UserNotFoundException, TransientException, AccessControlException; Loading
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapGroupDAO.java +7 −7 Original line number Diff line number Diff line Loading @@ -311,7 +311,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO { final Filter filter = Filter.createPresenceFilter("cn"); final String [] attributes = new String[] {"cn", "nsaccountlock"}; final List<String> groupNames = new ArrayList<String>(); final Collection<String> groupNames = new ArrayList<String>(); final long begin = System.currentTimeMillis(); final SearchResult searchResult = Loading Loading @@ -472,7 +472,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO User<X500Principal> owner; try { owner = userPersist.getMember(groupOwner); owner = userPersist.getX500User(groupOwner); } catch (UserNotFoundException e) { Loading Loading @@ -504,7 +504,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO User<X500Principal> user; try { user = userPersist.getMember(memberDN); user = userPersist.getX500User(memberDN); } catch (UserNotFoundException e) { Loading Loading @@ -972,7 +972,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO } Group group = new Group(searchResult.getAttributeValue("cn"), userPersist.getMember( userPersist.getX500User( new DN(searchResult.getAttributeValue( "owner")))); group.description = searchResult.getAttributeValue("description"); Loading Loading @@ -1076,7 +1076,7 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO try { User<X500Principal> subjectUser = userPersist.getMember(getSubjectDN()); userPersist.getX500User(getSubjectDN()); if (subjectUser.equals(owner)) { return true; Loading
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapGroupPersistence.java +0 −10 Original line number Diff line number Diff line Loading @@ -74,8 +74,6 @@ import java.util.Collection; import org.apache.log4j.Logger; import com.unboundid.ldap.sdk.DN; import ca.nrc.cadc.ac.Group; import ca.nrc.cadc.ac.GroupAlreadyExistsException; import ca.nrc.cadc.ac.GroupNotFoundException; Loading Loading @@ -147,14 +145,6 @@ public class LdapGroupPersistence<T extends Principal> } } public Collection<DN> getUserGroups(T userID, boolean isAdmin) throws UserNotFoundException, TransientException, AccessControlException { return (new LdapUserPersistence<T>()).getUserGroups(userID, isAdmin); } public Group addGroup(Group group) throws GroupAlreadyExistsException, TransientException, AccessControlException, UserNotFoundException, Loading
projects/cadcAccessControl-Server/src/ca/nrc/cadc/ac/server/ldap/LdapUserDAO.java +3 −3 Original line number Diff line number Diff line Loading @@ -359,8 +359,8 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO .getName()); addAttribute(attributes, LDAP_DISTINGUISHED_NAME, userDN .toNormalizedString()); addAttribute(attributes, LADP_USER_PASSWORD, userRequest .getPassword()); addAttribute(attributes, LADP_USER_PASSWORD, String.valueOf(userRequest.getPassword())); for (UserDetails details : user.details) { Loading Loading @@ -831,7 +831,7 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO * @throws UserNotFoundException * @throws LDAPException */ User<X500Principal> getMember(DN userDN) User<X500Principal> getX500User(DN userDN) throws UserNotFoundException, LDAPException { Filter filter = Loading