diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js index 93eb1884087ebb016a6698f63b2398798a814a4e..80df931da45dd206b4098670ff3fccfb08ce397a 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/common.js @@ -56,6 +56,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp this.ExternalDmsUpdate = dtos.ExternalDmsUpdate; this.TagUpdate = dtos.TagUpdate; this.AuthorizationGroupUpdate = dtos.AuthorizationGroupUpdate; + this.PersonUpdate = dtos.PersonUpdate; this.SpaceDeletionOptions = dtos.SpaceDeletionOptions; this.ProjectDeletionOptions = dtos.ProjectDeletionOptions; this.ExperimentDeletionOptions = dtos.ExperimentDeletionOptions; @@ -196,6 +197,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp this.UpdateExternalDmsOperation = dtos.UpdateExternalDmsOperation; this.UpdateTagsOperation = dtos.UpdateTagsOperation; this.UpdateAuthorizationGroupsOperation = dtos.UpdateAuthorizationGroupsOperation; + this.UpdatePersonsOperation = dtos.UpdatePersonsOperation; this.UpdateOperationExecutionsOperation = dtos.UpdateOperationExecutionsOperation; this.UpdateSemanticAnnotationsOperation = dtos.UpdateSemanticAnnotationsOperation; diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js index 292cd2d2567e13d2e7ffd7f7317f2c06969e794e..5ce29c77534160b3510251782352cbd7967855ed 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/dtos.js @@ -385,6 +385,9 @@ var sources = [ 'as/dto/person/search/UserIdsSearchCriteria', 'as/dto/person/search/SearchPersonsOperation', 'as/dto/person/search/SearchPersonsOperationResult', + 'as/dto/person/update/PersonUpdate', + 'as/dto/person/update/UpdatePersonsOperation', + 'as/dto/person/update/UpdatePersonsOperationResult', 'as/dto/person/Person', 'as/dto/project/create/ProjectCreation', diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/openbis-execute-operations.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/openbis-execute-operations.js index 7be7b42a82fcd5267097c3ff2ca18e61b39d0216..329f9d96061748bc091d89782bc573a8a034b5c2 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/openbis-execute-operations.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/openbis-execute-operations.js @@ -193,6 +193,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) { return this._executeUpdateOperation(new c.UpdateAuthorizationGroupsOperation(updates)); } + this.updatePersons = function(updates) { + return this._executeUpdateOperation(new c.UpdatePersonsOperation(updates)); + } + this.updateOperationExecutions = function(updates) { return this._executeUpdateOperation(new c.UpdateOperationExecutionsOperation(updates)); } diff --git a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js index 36cce824f717e87f363a597cf82a2ffb3cbf2116..d711db51e35bb74e91b9b3bf669c90978965e3ef 100644 --- a/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js +++ b/js-test/servers/common/core-plugins/tests/1/as/webapps/openbis-v3-api-test/html/test/test-update.js @@ -554,6 +554,64 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', ' testUpdate(c, fCreate, fUpdate, c.findAuthorizationGroup, fCheck); }); + QUnit.test("updatePersons()", function(assert) { + var c = new common(assert, openbis); + var userId = c.generateId("USER"); + + var fCreate = function(facade) { + var creation = new c.PersonCreation(); + creation.setUserId(userId); + return facade.createPersons([ creation ]).then(function(permIds) { + var creation = new c.RoleAssignmentCreation(); + creation.setUserId(permIds[0]); + creation.setRole(c.Role.ADMIN); + return facade.createRoleAssignments([ creation ]).then(function(assignmentId) { + return permIds; + }); + }); + } + + var fUpdate = function(facade, permId) { + var update = new c.PersonUpdate(); + update.setPersonId(permId); + update.setHomeSpaceId(new c.SpacePermId("TEST")) + return facade.updatePersons([ update ]); + } + + var fCheck = function(person) { + c.assertEqual(person.getUserId(), userId, "User id"); + c.assertEqual(person.getSpace().getCode(), "TEST", "Home space"); + c.assertEqual(person.isActive(), true, "Active"); + } + + testUpdate(c, fCreate, fUpdate, c.findPerson, fCheck); + }); + + QUnit.test("updatePersons() deactivate", function(assert) { + var c = new common(assert, openbis); + var userId = c.generateId("USER"); + + var fCreate = function(facade) { + var creation = new c.PersonCreation(); + creation.setUserId(userId); + return facade.createPersons([ creation ]); + } + + var fUpdate = function(facade, permId) { + var update = new c.PersonUpdate(); + update.setPersonId(permId); + update.deactivate(); + return facade.updatePersons([ update ]); + } + + var fCheck = function(person) { + c.assertEqual(person.getUserId(), userId, "User id"); + c.assertEqual(person.isActive(), false, "Active"); + } + + testUpdate(c, fCreate, fUpdate, c.findPerson, fCheck); + }); + QUnit.test("updateOperationExecutions()", function(assert) { var c = new common(assert, openbis); var permId = null;