Enable/Disable user programmatically
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-02-2013 06:42 PM
I'm creating users via a custom UserRegistry returning NodeDescription with properties.
e.g.
PropertyMap properties = node.getProperties();
properties.put(ContentModel.PROP_USERNAME, user.getName());
properties.put(ContentModel.PROP_FIRSTNAME, user.getFirstName());
properties.put(ContentModel.PROP_LASTNAME, user.getLastName());
properties.put(ContentModel.PROP_EMAIL, user.getEmailAddress());
However, it appears some users are coming up as disabled, particularly when viewed via share.
What property or service methods are available to set the user to enabled.
I tried these two, PROP_ENABLED & PROP_MODEL_ACTIVE
But they didn't seem to affect share.
Thanks
e.g.
PropertyMap properties = node.getProperties();
properties.put(ContentModel.PROP_USERNAME, user.getName());
properties.put(ContentModel.PROP_FIRSTNAME, user.getFirstName());
properties.put(ContentModel.PROP_LASTNAME, user.getLastName());
properties.put(ContentModel.PROP_EMAIL, user.getEmailAddress());
However, it appears some users are coming up as disabled, particularly when viewed via share.
What property or service methods are available to set the user to enabled.
I tried these two, PROP_ENABLED & PROP_MODEL_ACTIVE
But they didn't seem to affect share.
Thanks
Labels:
- Labels:
-
Archive
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2013 01:44 AM
Yes, once you create the user you need to create authentication for that user which will enable the user in repo.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-03-2013 09:30 PM
I'm not sure I totally follow. The user exists in the repo. I just don't seem to be able to control the enable/disable flag.
e.g.
authenticationService.setAuthenticationEnabled(user.getName(), false);
logger.debug(" Is this user mutable? " + authenticationService.isAuthenticationMutable(user.getName()) + " ,enabled? " + authenticationService.getAuthenticationEnabled(user.getName()));
logger.debug(" Is person enabled? " + personService.isEnabled(user.getName()));
The above outputs that the user is mutable and enabled even though the first line specifically disables the user.
SO I'm at a loss as to how to properly control the enable/disable of a user account.
Similar I guess to this thread which doesn't have a resolution either - http://forums.alfresco.com/forum/installation-upgrades-configuration-integration/authentication-ldap...
e.g.
authenticationService.setAuthenticationEnabled(user.getName(), false);
logger.debug(" Is this user mutable? " + authenticationService.isAuthenticationMutable(user.getName()) + " ,enabled? " + authenticationService.getAuthenticationEnabled(user.getName()));
logger.debug(" Is person enabled? " + personService.isEnabled(user.getName()));
The above outputs that the user is mutable and enabled even though the first line specifically disables the user.
SO I'm at a loss as to how to properly control the enable/disable of a user account.
Similar I guess to this thread which doesn't have a resolution either - http://forums.alfresco.com/forum/installation-upgrades-configuration-integration/authentication-ldap...
