02-08-2009 11:07 AM
public void createUser(String firstName ,String lastName ,String userName ,String password ,
String email ,String securityRole ,String notificationGroups ,String history) {
Map<QName, Serializable> newProperties=createDefaultProperties(firstName ,lastName ,userName ,password ,email , securityRole ,notificationGroups ,history);
NodeRef newPerson = getPersonService().createPerson(newProperties);
getAuthenticationService().createAuthentication(userName, password.toCharArray());
getPermissionService().setPermission(newPerson, userName, getPermissionService().getAllPermission(), true);
}
private Map<QName, Serializable> createDefaultProperties(String firstName ,String lastName ,String userName ,String password ,String email ,
String securityRole ,String notificationGroups ,String history )
{
HashMap<QName, Serializable> properties = new HashMap<QName, Serializable>();
properties.put(org.alfresco.model.ContentModel.PROP_HOMEFOLDER, new AlfSearchServices().getNodeRef("/app:company_home/cm:Acme/cm:Users"));
properties.put(ContentModel.PROP_FIRSTNAME, firstName);
properties.put(ContentModel.PROP_LASTNAME, lastName);
properties.put(ContentModel.PROP_USERNAME, userName);
properties.put(ContentModel.PROP_PASSWORD, password);
properties.put(ContentModel.PROP_EMAIL, email);
properties.put(ContentModel.PROP_SECURITYROLE, securityRole);
properties.put(ContentModel.PROP_NOTIFICATIONGROUP, notificationGroups);
properties.put(ContentModel.PROP_HISTORY, history);
return properties;
}
02-08-2009 11:56 AM
02-09-2009 02:49 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.