REPO-1503: password is now mandatory.

First check in at my new desk!

I've also removed the auto-generation of passwords (UUID) since this is no longer needed with a mandatory password field.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@132027 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2016-11-01 15:02:25 +00:00
parent 247d2ad97a
commit 1a8fe7785f
2 changed files with 7 additions and 2 deletions

View File

@@ -297,8 +297,7 @@ public class PeopleImpl implements People
Map<QName, Serializable> props = person.toProperties(); Map<QName, Serializable> props = person.toProperties();
MutableAuthenticationService mas = (MutableAuthenticationService) authenticationService; MutableAuthenticationService mas = (MutableAuthenticationService) authenticationService;
String password = person.getPassword() == null ? UUID.randomUUID().toString() : person.getPassword(); mas.createAuthentication(person.getUserName(), person.getPassword().toCharArray());
mas.createAuthentication(person.getUserName(), password.toCharArray());
mas.setAuthenticationEnabled(person.getUserName(), person.isEnabled()); mas.setAuthenticationEnabled(person.getUserName(), person.isEnabled());
NodeRef nodeRef = personService.createPerson(props); NodeRef nodeRef = personService.createPerson(props);
@@ -328,6 +327,7 @@ public class PeopleImpl implements People
checkRequiredField("firstName", person.getFirstName()); checkRequiredField("firstName", person.getFirstName());
checkRequiredField("email", person.getEmail()); checkRequiredField("email", person.getEmail());
checkRequiredField("enabled", person.isEnabled()); checkRequiredField("enabled", person.isEnabled());
checkRequiredField("password", person.getPassword());
} }
private void checkRequiredField(String fieldName, Object fieldValue) private void checkRequiredField(String fieldName, Object fieldValue)

View File

@@ -143,6 +143,7 @@ public class TestPeople extends EnterpriseTestApi
userStatus("userStatus"). userStatus("userStatus").
enabled(true). enabled(true).
emailNotificationsEnabled(true). emailNotificationsEnabled(true).
password("password").
build(); build();
Person p = people.create(person); Person p = people.create(person);
@@ -258,6 +259,7 @@ public class TestPeople extends EnterpriseTestApi
telephone("1234 5678 9012"). telephone("1234 5678 9012").
enabled(false). enabled(false).
emailNotificationsEnabled(false). emailNotificationsEnabled(false).
password("password123").
build(); build();
Person p = people.create(person); Person p = people.create(person);
@@ -287,6 +289,7 @@ public class TestPeople extends EnterpriseTestApi
firstName("Joe"). firstName("Joe").
email("joe.bloggs.2@example.com"). email("joe.bloggs.2@example.com").
enabled(true). enabled(true).
password("password-is-secret").
build(); build();
Person p = people.create(person); Person p = people.create(person);
@@ -372,6 +375,7 @@ public class TestPeople extends EnterpriseTestApi
firstName("Kieth"). firstName("Kieth").
email("keith.smith@example.com"). email("keith.smith@example.com").
enabled(true). enabled(true).
password("password").
build(); build();
people.create(person, 403); people.create(person, 403);
@@ -388,6 +392,7 @@ public class TestPeople extends EnterpriseTestApi
firstName("Alison"). firstName("Alison").
email("alison.smythe@example.com"). email("alison.smythe@example.com").
enabled(true). enabled(true).
password("secret").
build(); build();
people.create(person); people.create(person);