Programmatically enable disabled account
I'm trying to programmatically create, disable and enable CQ5 user account. I'm able to create and disable the account but I don't know how to enable it again. Here's my code
org.apache.jackrabbit.api.security.user.UserManager um = request.getResourceResolver().adaptTo(org.apache.jackrabbit.api.security.user.UserManager.class); org.apache.jackrabbit.api.security.user.User user = um.createUser(login, password); user.disable("Waiting for moderation!"); Node node = request.getResourceResolver().getResource(user.getPath()).adaptTo(Node.class); node.setProperty("rep:disabled", (String)null); // This is how I'm trying to enable the accountbut this doesn't work - I get exception that tells me that the property rep:disabled is not modifiable. How can I enable the disabled account?
BTW the code here is just for demonstration. In fact I have the disable and enable sections separated.
Thanks for any help.
EDIT the Exception
Exception javax.jcr.nodetype.ConstraintViolationException: Attempt to modify protected property rep:disabled of User 'testUser'