AnsweredAssumed Answered

Creating user in a different home space

Question asked by mmrs on Feb 8, 2009
Latest reply on Feb 9, 2009 by mmrs
hi all
i'm trying to change the default home space for the users in my project

the default is :Company Home > User Homes but ….

i want it to be in the following dir : Company Home > Acme > Users

'Acme' is the node of my project, and there..every thing should be stored

i tried this code :

- the createUser method : create default user with full permission

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);
}

- the createDefaultProperties methods : create user properities with home folder pointing to "/app:company_home/cm:Acme/cm:Users"

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;
    }

but it's not working !
i think i have some hidden mistake…. pls help me identify it :)

thanx in advance
mmrs

Outcomes