cancel
Showing results for 
Search instead for 
Did you mean: 

Creating Users using JAVA API

yvinodh
Champ in-the-making
Champ in-the-making
Hi all,

         I am using Alfresco 2.9.In my application i need to create users using JAVA API. Can anyone help me in this.
         Thanks in Advance

Regards,
Yvinodh.
41 REPLIES 41

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

Hey all, thanks in advance for the help.  I'm writing a file movement utility using the RAAR 1.5 api and Alf 2.1.  I'm noticing that when a node is copied in the same folder, the paths of the two nodes remain identical.  How does one change the path of the new node once it's created?

Not sure I understand what you mean by identical paths. Can you give an example?

Also, is there a way to copy a node and specify the new name?
Yes, you could use the NodeService to copy as usual then rename the document:

NodeRef rename(Ticket ticket, NodeRef nodeRef, String newName)

Hope this helps,

–Alaaeldin

lrjava
Champ in-the-making
Champ in-the-making
How do you change the password for the users programatically?

i have the same problem… Smiley Sad
has anyone solved this problem?

thanks.

rivetlogic
Champ on-the-rise
Champ on-the-rise
The bad news is: there isn't a method for that at the moment.

The good news is: we'll add one and release a new version, 1.10.0, (hopefully this weekend).

I created a JIRA for this, you can track it here:
http://issues.rivetlogic.org/browse/CMA-40

You'll also be interested in this (makes it easier to add a user to a group, this is also planned for 1.10.0):
http://issues.rivetlogic.org/browse/CMA-39

Cheers.

–Sumer

jmluy
Champ in-the-making
Champ in-the-making
Thanks Sumer, will be waiting for 1.10.0

rivetlogic
Champ on-the-rise
Champ on-the-rise

lrjava
Champ in-the-making
Champ in-the-making
thank you very much for the release.

perhaps, my usages for the setting of password were unclear (my mistake).
i am looking at the code for 1.10.0, i am not sure if the following scenarios are applicable
1. force reset / forgot password (no old password required)
2. triggered by admin (no old password required)

i will try to perform test and post my results later.

regards

rivetlogic
Champ on-the-rise
Champ on-the-rise
1.11.0 will be out tomorrow night (best guess). It'll have more coverage for user/password admin.

Stay tuned.

–Sumer

rivetlogic
Champ on-the-rise
Champ on-the-rise

gerrit
Champ in-the-making
Champ in-the-making
Hi all

I am still struggling with creating a user, using the java api, and logging in with that user from the ui.

I am running webscripts backed by java and output to a xml freemarker template. Now I have managed to authenticate as admin using the AuthenticationService then creating a person object using createPerson() from the PersonService. It creates the person object and a home space for the person in \Company Home\User Homes\[user name]  with all the properties I define, but still i cannot log in as this person.

From what I've read in the forum and the wiki etc. I've come to realise that the person object holds no account properties, ie password etc. So therefore there is a need to associate a user object with this person object.

My question now is, am I on the right track? and if so, How do I create a user object and associate it with the person object, so that I can log into the alfresco UI as this person?
If I'm completely off track please tell me and guide me in the right way.

Any help would be greatly appreciated!!

Regards
Gerrit

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

In AFS (Alfresco Foundation Services) you need to make a number of calls to create a new user fully:


// create the node to represent the Person
NodeRef newPerson = this.personService.createPerson(props);
          
// ensure the user can access their own Person object
this.permissionService.setPermission(newPerson, authority, permissionService.getAllPermission(), true);
          
// create the ACEGI Authentication instance for the new user
this.authenticationService.createAuthentication(authority, password.toCharArray());
Hope this helps,

–Alaaeldin