mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
First parts of Create User functionality in new Admin Console.
- Can create new users - no form validation etc. yet. - User password is set. ChangePassword webscript improved to support admin user setting a user password without knowing the old one. JavaScript People API fixes. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@14097 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
package org.alfresco.repo.jscript;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
@@ -188,42 +187,35 @@ public final class People extends BaseScopableProcessorExtension
|
||||
ParameterCheck.mandatory("lastName", lastName);
|
||||
ParameterCheck.mandatory("createUserAccount", createUserAccount);
|
||||
ParameterCheck.mandatory("setAccountEnabled", setAccountEnabled);
|
||||
|
||||
|
||||
ScriptNode person = null;
|
||||
|
||||
|
||||
// generate user name
|
||||
for(int i=0; i < numRetries; i++)
|
||||
for (int i=0; i < numRetries; i++)
|
||||
{
|
||||
String userName = usernameGenerator.generateUserName(firstName, lastName, emailAddress, i);
|
||||
|
||||
|
||||
// create person if user name does not already exist
|
||||
if (!personService.personExists(userName))
|
||||
{
|
||||
person = createPerson(userName, firstName, lastName, emailAddress);
|
||||
|
||||
|
||||
if (createUserAccount)
|
||||
{
|
||||
// generate password
|
||||
char[] password = passwordGenerator.generatePassword().toCharArray();
|
||||
|
||||
// create account for person with generated userName and
|
||||
// password
|
||||
|
||||
// create account for person with generated userName and password
|
||||
mutableAuthenticationDao.createUser(userName, password);
|
||||
mutableAuthenticationDao.setEnabled(userName, setAccountEnabled);
|
||||
|
||||
// TODO glen johnson at alfresco dot com -
|
||||
// find a more secure way of making generated password
|
||||
// available. I need to make it available for the invite
|
||||
// workflow/service
|
||||
person.getProperties().put("generatedPassword", new String(password));
|
||||
|
||||
person.save();
|
||||
}
|
||||
|
||||
return person;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
return person;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user