From 0e5f80f4ebdb118254098443d40ba1726d10f55a Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Thu, 3 Nov 2016 14:03:00 +0000 Subject: [PATCH] Merged 5.2.N (5.2.1) to HEAD (5.2) 132027 mward: 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/HEAD/root@132327 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- source/java/org/alfresco/rest/api/impl/PeopleImpl.java | 4 ++-- source/test-java/org/alfresco/rest/api/tests/TestPeople.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/java/org/alfresco/rest/api/impl/PeopleImpl.java b/source/java/org/alfresco/rest/api/impl/PeopleImpl.java index 6949dc9f90..08b8df2dbe 100644 --- a/source/java/org/alfresco/rest/api/impl/PeopleImpl.java +++ b/source/java/org/alfresco/rest/api/impl/PeopleImpl.java @@ -297,8 +297,7 @@ public class PeopleImpl implements People Map props = person.toProperties(); MutableAuthenticationService mas = (MutableAuthenticationService) authenticationService; - String password = person.getPassword() == null ? UUID.randomUUID().toString() : person.getPassword(); - mas.createAuthentication(person.getUserName(), password.toCharArray()); + mas.createAuthentication(person.getUserName(), person.getPassword().toCharArray()); mas.setAuthenticationEnabled(person.getUserName(), person.isEnabled()); NodeRef nodeRef = personService.createPerson(props); @@ -328,6 +327,7 @@ public class PeopleImpl implements People checkRequiredField("firstName", person.getFirstName()); checkRequiredField("email", person.getEmail()); checkRequiredField("enabled", person.isEnabled()); + checkRequiredField("password", person.getPassword()); } private void checkRequiredField(String fieldName, Object fieldValue) diff --git a/source/test-java/org/alfresco/rest/api/tests/TestPeople.java b/source/test-java/org/alfresco/rest/api/tests/TestPeople.java index b53a3d567d..0539ef939f 100644 --- a/source/test-java/org/alfresco/rest/api/tests/TestPeople.java +++ b/source/test-java/org/alfresco/rest/api/tests/TestPeople.java @@ -143,6 +143,7 @@ public class TestPeople extends EnterpriseTestApi userStatus("userStatus"). enabled(true). emailNotificationsEnabled(true). + password("password"). build(); Person p = people.create(person); @@ -258,6 +259,7 @@ public class TestPeople extends EnterpriseTestApi telephone("1234 5678 9012"). enabled(false). emailNotificationsEnabled(false). + password("password123"). build(); Person p = people.create(person); @@ -287,6 +289,7 @@ public class TestPeople extends EnterpriseTestApi firstName("Joe"). email("joe.bloggs.2@example.com"). enabled(true). + password("password-is-secret"). build(); Person p = people.create(person); @@ -372,6 +375,7 @@ public class TestPeople extends EnterpriseTestApi firstName("Kieth"). email("keith.smith@example.com"). enabled(true). + password("password"). build(); people.create(person, 403); @@ -388,6 +392,7 @@ public class TestPeople extends EnterpriseTestApi firstName("Alison"). email("alison.smythe@example.com"). enabled(true). + password("secret"). build(); people.create(person);