cancel
Showing results for 
Search instead for 
Did you mean: 

Create user webscript - works but....

iann
Champ in-the-making
Champ in-the-making
Hi,

I've created a simple webscript that creates users - below is a test sample. All work's well and i'm about to expand the functionality further, but I have an error whenever I try to delete a user that's been created using the script.

It is:

Unable to delete the User object associated with the Person. This is not an error if an external authentication mechanism such as NTLM was previously active.
Failed to delete User due to error: org.alfresco.repo.security.authentication.AuthenticationException: 01020006 User name does not exist: testuser@gmail.com


Any help would be greatly appreciated!
Thanks,

Ian

script:
{
model.firstName = "Test";
model.lastName = "User";
model.emailAddress = "testuser@gmail.com";

var user = people.createPerson(model.emailAddress);
user.properties["cm:firstName"] = model.firstName;
user.properties["cm:lastName"] = model.lastName;
user.properties["usrSmiley Tongueassword"] = "testtest";
user.save();
}
5 REPLIES 5

dward
Champ on-the-rise
Champ on-the-rise
This problem was fixed in later versions

You are creating a person without authentication, and previously the delete function failed if it couldn't find any authentication information. Now it doesn't matter.

Try this, to create a person with a password.

people.createPerson(null, model.firstName, model.lastName, model.emailAddress, "password");

iann
Champ in-the-making
Champ in-the-making
Hi thanks for your help.

I get a Can't find method org.alfresco.repo.jscript.People.createPerson(null,string,string,string,string). (workspace://SpacesStore/Company Home/Data Dictionary/Web Scripts Extensions/createperson.get.js#9)

..message when trying to run that, how can I create a user with authentication so that I'm able to delete them if needs be.

thanks again for the help.

Regards,

Ian

mrogers
Star Contributor
Star Contributor
What version are you using?

iann
Champ in-the-making
Champ in-the-making
Thanks for the reply, it's 3.2, not r or r2!

iann
Champ in-the-making
Champ in-the-making
Hi,

thanks for the responses - still having issues. I waswondering if someone could point me in the right direction, it seems my web script for creating users is created corrupt users without authentication - any ideas how I could fix this?

Any help would be greatly appreciated.

Thank Ian