Skip to content
Snippets Groups Projects
Commit 77787224 authored by Alinga Yeung's avatar Alinga Yeung
Browse files

Merge branch 's1840' of /srv/cadc/git/wopencadc into s1840

parents 6278e836 6928a0c9
No related branches found
No related tags found
No related merge requests found
Showing with 529 additions and 328 deletions
......@@ -91,9 +91,9 @@ public interface UserPersistence<T extends Principal>
throws TransientException, AccessControlException;
/**
* Add the new user.
* Add the user to the active user tree.
*
* @param user The user request to put into the request tree.
* @param user The user request to put into the active user tree.
*
* @return User instance.
*
......@@ -104,6 +104,20 @@ public interface UserPersistence<T extends Principal>
throws TransientException, AccessControlException,
UserAlreadyExistsException;
/**
* Add the user to the pending user tree.
*
* @param user The user request to put into the pending user tree.
*
* @return User instance.
*
* @throws TransientException If an temporary, unexpected problem occurred.
* @throws AccessControlException If the operation is not permitted.
*/
void addPendingUser(UserRequest<T> user)
throws TransientException, AccessControlException,
UserAlreadyExistsException;
/**
* Get the user specified by userID.
*
......
......@@ -980,6 +980,8 @@ public class LdapGroupDAO<T extends Principal> extends LdapDAO
{
try
{
// TODO Subject has the X500Principal, no need to go to ldap.
// TODO X500Principal is optional???
User<X500Principal> subjectUser =
userPersist.getX500User(getSubjectDN());
if (subjectUser.equals(owner))
......
......@@ -117,9 +117,9 @@ public class LdapUserPersistence<T extends Principal>
}
/**
* Add the new user.
* Add the user to the active user tree.
*
* @param user
* @param user The user request to put into the active user tree.
*
* @return User instance.
*
......@@ -145,6 +145,35 @@ public class LdapUserPersistence<T extends Principal>
}
}
/**
* Add the user to the pending user tree.
*
* @param user The user request to put into the pending user tree.
*
* @return User instance.
*
* @throws TransientException If an temporary, unexpected problem occurred.
* @throws AccessControlException If the operation is not permitted.
*/
public void addPendingUser(UserRequest<T> user)
throws TransientException, AccessControlException,
UserAlreadyExistsException
{
LdapUserDAO<T> userDAO = null;
try
{
userDAO = new LdapUserDAO<T>(this.config);
userDAO.addPendingUser(user);
}
finally
{
if (userDAO != null)
{
userDAO.close();
}
}
}
/**
* Get the user specified by userID.
*
......@@ -183,9 +212,8 @@ public class LdapUserPersistence<T extends Principal>
* @throws TransientException If an temporary, unexpected problem occurred.
* @throws AccessControlException If the operation is not permitted.
*/
public User<T> getPendingUser(final T userID) throws UserNotFoundException,
TransientException,
AccessControlException
public User<T> getPendingUser(final T userID)
throws UserNotFoundException, TransientException, AccessControlException
{
LdapUserDAO<T> userDAO = null;
try
......
......@@ -93,7 +93,7 @@ public class CreateUserAction extends AbstractUserAction
{
final UserPersistence<Principal> userPersistence = getUserPersistence();
final UserRequest<Principal> userRequest = readUserRequest(this.inputStream);
userPersistence.addUser(userRequest);
userPersistence.addPendingUser(userRequest);
syncOut.setCode(201);
logUserInfo(userRequest.getUser().getUserID().getName());
......
......@@ -68,8 +68,8 @@
*/
package ca.nrc.cadc.ac.server.web.users;
import ca.nrc.cadc.ac.User;
import ca.nrc.cadc.ac.server.UserPersistence;
import java.security.Principal;
public class DeleteUserAction extends AbstractUserAction
......@@ -85,8 +85,7 @@ public class DeleteUserAction extends AbstractUserAction
public void doAction() throws Exception
{
UserPersistence userPersistence = getUserPersistence();
User<? extends Principal> deletedUser = userPersistence.getUser(userID);
userPersistence.deleteUser(deletedUser.getUserID());
userPersistence.deleteUser(userID);
}
}
......@@ -156,7 +156,6 @@ public class GetUserAction extends AbstractUserAction
user.details.clear();
user.details.add(new PersonalDetails(pd.getFirstName(), pd.getLastName()));
}
}
return user;
......
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