Hi,
here are the methods to retrieve a created user:
public User getUser(Session session, String userId)
throws RepositoryException {
UserManager um = getUserManager(session);
Authorizable auth = um.getAuthorizable(userId);
if (auth instanceof User) {
return (User) um.getAuthorizable(userId);
} else {
throw new RepositoryException("The userid '" + userId
+ "' is no valid repository user.");
}
}
private UserManager getUserManager(Session session)
throws RepositoryException {
if (session instanceof JackrabbitSession) {
return ((JackrabbitSession) session).getUserManager();
} else {
throw new RepositoryException(
"This JCR implementation does not have a UserManager.");
}
}
public List<String> getAllRegisteredUsers(Session session)
throws RepositoryException {
List<String> list = new ArrayList<String>();
int type = UserManager.SEARCH_TYPE_USER; // or group or user
Iterator<Authorizable> auths =
getUserManager(session).findAuthorizables("rep:principalName",
null, type);
while (auths.hasNext()) {
Authorizable authorizable = (Authorizable) auths.next();
list.add(authorizable.getID());
}
return list;
}
Bye,
Ulrich