mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Various fixes to REST Person Service and Web Script Unit Test
- Delete people and authentications for users created in setUp() - Modify person.lib.ftl so that it copes with firstName and lastName being undefined - Modify people.post.js to use var.properties["propKey"]=value when adding person properties so that it copes with setting properties that don't already exist git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@9619 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -19,12 +19,12 @@ function main()
|
||||
}
|
||||
|
||||
// assign values to the person's properties
|
||||
person.properties.title = json.get("title");
|
||||
person.properties.firstName = json.get("firstName");
|
||||
person.properties.lastName = json.get("lastName");
|
||||
person.properties.organization = json.get("organisation");
|
||||
person.properties.jobTitle = json.get("jobTitle");
|
||||
person.properties.email = json.get("email");
|
||||
person.properties["title"] = json.get("title");
|
||||
person.properties["firstName"] = json.get("firstName");
|
||||
person.properties["lastName"] = json.get("lastName");
|
||||
person.properties["organization"] = json.get("organisation");
|
||||
person.properties["jobTitle"] = json.get("jobTitle");
|
||||
person.properties["email"] = json.get("email");
|
||||
person.save();
|
||||
|
||||
// Put the created person into the model
|
||||
|
@@ -7,8 +7,16 @@
|
||||
<#else>
|
||||
"title" : undefined,
|
||||
</#if>
|
||||
<#if person.properties.firstName??>
|
||||
"firstName" : "${person.properties.firstName}",
|
||||
<#else>
|
||||
"firstName" : undefined,
|
||||
</#if>
|
||||
<#if person.properties.lastName??>
|
||||
"lastName" : "${person.properties.lastName}",
|
||||
<#else>
|
||||
"lastName" : undefined,
|
||||
</#if>
|
||||
<#if person.properties.organization??>
|
||||
"organisation" : "${person.properties.organization}",
|
||||
<#else>
|
||||
|
@@ -29,16 +29,11 @@ import java.util.List;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||
import org.alfresco.repo.site.SiteModel;
|
||||
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
||||
import org.alfresco.service.cmr.security.AuthenticationService;
|
||||
import org.alfresco.service.cmr.security.PersonService;
|
||||
import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
import org.alfresco.util.PropertyMap;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.springframework.mock.web.MockHttpServletResponse;
|
||||
|
||||
@@ -94,6 +89,8 @@ public class PersonServiceTest extends BaseWebScriptTest
|
||||
personProps.put(ContentModel.PROP_JOBTITLE, "myOrganisation");
|
||||
|
||||
this.personService.createPerson(personProps);
|
||||
|
||||
this.createdPeople.add(userName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,6 +113,11 @@ public class PersonServiceTest extends BaseWebScriptTest
|
||||
personService.deletePerson(userName);
|
||||
}
|
||||
|
||||
// delete authentications for users created in setUp()
|
||||
this.authenticationService.deleteAuthentication(USER_ONE);
|
||||
this.authenticationService.deleteAuthentication(USER_TWO);
|
||||
this.authenticationService.deleteAuthentication(USER_THREE);
|
||||
|
||||
// Clear the list
|
||||
this.createdPeople.clear();
|
||||
}
|
||||
|
Reference in New Issue
Block a user