in src/main/java/org/apache/sling/jackrabbit/usermanager/impl/post/UpdateUserServlet.java [168:212]
public User updateUser(Session jcrSession, String name,
Map<String, ?> properties, List<Modification> changes)
throws RepositoryException {
User user;
UserManager userManager = AccessControlUtil.getUserManager(jcrSession);
Authorizable authorizable = userManager.getAuthorizable(name);
if (authorizable instanceof User) {
user = (User)authorizable;
} else {
throw new ResourceNotFoundException(
"User to update could not be determined");
}
Map<String, RequestProperty> reqPropertiesMap = collectContentMap(properties);
Collection<RequestProperty> reqPropertyValues = reqPropertiesMap.values();
try {
// cleanup any old content (@Delete parameters)
processDeletes(user, reqPropertyValues, changes);
// ensure root of new content with the expected primary/mixin types
processCreate(jcrSession, user, reqPropertiesMap, changes);
// write content from form
writeContent(jcrSession, user, reqPropertyValues, changes);
//SLING-2072 set the user as enabled or disabled if the request
// has supplied the relevant properties
String disabledParam = convertToString(properties.get(":disabled"));
if ("true".equalsIgnoreCase(disabledParam)) {
//set the user as disabled
String disabledReason = convertToString(properties.get(":disabledReason"));
if (disabledReason == null) {
disabledReason = "";
}
user.disable(disabledReason);
} else if ("false".equalsIgnoreCase(disabledParam)) {
//re-enable a disabled user
user.disable(null);
}
} catch (RepositoryException re) {
throw new RepositoryException("Failed to update user.", re);
}
return user;
}