Skip to content
Snippets Groups Projects
Commit d710efbd authored by piotr.kupczyk@id.ethz.ch's avatar piotr.kupczyk@id.ethz.ch
Browse files

V3_API : delete persons : SSDM-10395 - JavaScript part

parent 557994bc
No related branches found
No related tags found
No related merge requests found
Showing
with 93 additions and 0 deletions
...@@ -87,6 +87,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -87,6 +87,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.RoleAssignmentDeletionOptions = dtos.RoleAssignmentDeletionOptions; this.RoleAssignmentDeletionOptions = dtos.RoleAssignmentDeletionOptions;
this.SemanticAnnotationDeletionOptions = dtos.SemanticAnnotationDeletionOptions; this.SemanticAnnotationDeletionOptions = dtos.SemanticAnnotationDeletionOptions;
this.QueryDeletionOptions = dtos.QueryDeletionOptions; this.QueryDeletionOptions = dtos.QueryDeletionOptions;
this.PersonDeletionOptions = dtos.PersonDeletionOptions;
this.PersonPermId = dtos.PersonPermId; this.PersonPermId = dtos.PersonPermId;
this.Me = dtos.Me; this.Me = dtos.Me;
this.EntityTypePermId = dtos.EntityTypePermId; this.EntityTypePermId = dtos.EntityTypePermId;
...@@ -349,6 +350,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -349,6 +350,7 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
this.DeleteOperationExecutionsOperation = dtos.DeleteOperationExecutionsOperation; this.DeleteOperationExecutionsOperation = dtos.DeleteOperationExecutionsOperation;
this.DeleteSemanticAnnotationsOperation = dtos.DeleteSemanticAnnotationsOperation; this.DeleteSemanticAnnotationsOperation = dtos.DeleteSemanticAnnotationsOperation;
this.DeleteQueriesOperation = dtos.DeleteQueriesOperation; this.DeleteQueriesOperation = dtos.DeleteQueriesOperation;
this.DeletePersonsOperation = dtos.DeletePersonsOperation;
this.RevertDeletionsOperation = dtos.RevertDeletionsOperation; this.RevertDeletionsOperation = dtos.RevertDeletionsOperation;
this.ConfirmDeletionsOperation = dtos.ConfirmDeletionsOperation; this.ConfirmDeletionsOperation = dtos.ConfirmDeletionsOperation;
...@@ -1055,6 +1057,13 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp ...@@ -1055,6 +1057,13 @@ define([ 'jquery', 'openbis', 'underscore', 'test/dtos' ], function($, defaultOp
return facade.deleteQueries([ id ], options); return facade.deleteQueries([ id ], options);
}.bind(this); }.bind(this);
this.deletePerson = function(facade, id) {
var c = this;
var options = new dtos.PersonDeletionOptions();
options.setReason("test reason");
return facade.deletePersons([ id ], options);
}.bind(this);
this.getObjectProperty = function(object, propertyName) { this.getObjectProperty = function(object, propertyName) {
var propertyNames = propertyName.split('.'); var propertyNames = propertyName.split('.');
for ( var pn in propertyNames) { for ( var pn in propertyNames) {
......
...@@ -430,6 +430,9 @@ var sources = [ ...@@ -430,6 +430,9 @@ var sources = [
'as/dto/person/create/PersonCreation', 'as/dto/person/create/PersonCreation',
'as/dto/person/create/CreatePersonsOperation', 'as/dto/person/create/CreatePersonsOperation',
'as/dto/person/create/CreatePersonsOperationResult', 'as/dto/person/create/CreatePersonsOperationResult',
'as/dto/person/delete/DeletePersonsOperation',
'as/dto/person/delete/DeletePersonsOperationResult',
'as/dto/person/delete/PersonDeletionOptions',
'as/dto/person/get/GetPersonsOperation', 'as/dto/person/get/GetPersonsOperation',
'as/dto/person/get/GetPersonsOperationResult', 'as/dto/person/get/GetPersonsOperationResult',
'as/dto/person/id/Me', 'as/dto/person/id/Me',
......
...@@ -568,6 +568,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) { ...@@ -568,6 +568,10 @@ define([ 'jquery', 'openbis', 'test/common' ], function($, openbis, common) {
return this._executeDeleteOperation(new c.DeleteQueriesOperation(ids, deletionOptions)); return this._executeDeleteOperation(new c.DeleteQueriesOperation(ids, deletionOptions));
} }
this.deletePersons = function(ids, deletionOptions) {
return this._executeDeleteOperation(new c.DeletePersonsOperation(ids, deletionOptions));
}
this.searchDeletions = function(criteria, fetchOptions) { this.searchDeletions = function(criteria, fetchOptions) {
return this._executeSearchOperation(new c.SearchDeletionsOperation(criteria, fetchOptions)); return this._executeSearchOperation(new c.SearchDeletionsOperation(criteria, fetchOptions));
} }
......
...@@ -307,6 +307,11 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', ' ...@@ -307,6 +307,11 @@ define([ 'jquery', 'underscore', 'openbis', 'test/openbis-execute-operations', '
testDeleteWithoutTrash(c, c.createQuery, c.findQuery, c.deleteQuery); testDeleteWithoutTrash(c, c.createQuery, c.findQuery, c.deleteQuery);
}); });
QUnit.test("deletePersons()", function(assert) {
var c = new common(assert, openbis);
testDeleteWithoutTrash(c, c.createPerson, c.findPerson, c.deletePerson);
});
} }
return function() { return function() {
......
define(['stjs', 'as/dto/common/delete/DeleteObjectsOperation'], function (
stjs,
DeleteObjectsOperation
) {
var DeletePersonsOperation = function (objectIds, options) {
DeleteObjectsOperation.call(this, objectIds, options)
}
stjs.extend(
DeletePersonsOperation,
DeleteObjectsOperation,
[DeleteObjectsOperation],
function (constructor, prototype) {
prototype['@type'] = 'as.dto.person.delete.DeletePersonsOperation'
prototype.getMessage = function () {
return 'DeletePersonsOperation'
}
},
{}
)
return DeletePersonsOperation
})
define([
'stjs',
'as/dto/common/delete/DeleteObjectsWithoutTrashOperationResult'
], function (stjs, DeleteObjectsWithoutTrashOperationResult) {
var DeletePersonsOperationResult = function () {
DeleteObjectsWithoutTrashOperationResult.call(this)
}
stjs.extend(
DeletePersonsOperationResult,
DeleteObjectsWithoutTrashOperationResult,
[DeleteObjectsWithoutTrashOperationResult],
function (constructor, prototype) {
prototype['@type'] = 'as.dto.person.delete.DeletePersonsOperationResult'
prototype.getMessage = function () {
return 'DeletePersonsOperationResult'
}
},
{}
)
return DeletePersonsOperationResult
})
define(['stjs', 'as/dto/deletion/AbstractObjectDeletionOptions'], function (
stjs,
AbstractObjectDeletionOptions
) {
var PersonDeletionOptions = function () {
AbstractObjectDeletionOptions.call(this)
}
stjs.extend(
PersonDeletionOptions,
AbstractObjectDeletionOptions,
[AbstractObjectDeletionOptions],
function (constructor, prototype) {
prototype['@type'] = 'as.dto.person.delete.PersonDeletionOptions'
constructor.serialVersionUID = 1
},
{}
)
return PersonDeletionOptions
})
...@@ -1882,6 +1882,17 @@ define([ 'jquery', 'util/Json', 'as/dto/datastore/search/DataStoreSearchCriteria ...@@ -1882,6 +1882,17 @@ define([ 'jquery', 'util/Json', 'as/dto/datastore/search/DataStoreSearchCriteria
}); });
} }
this.deletePersons = function(ids, deletionOptions) {
var thisFacade = this;
return thisFacade._private.ajaxRequest({
url : openbisUrl,
data : {
"method" : "deletePersons",
"params" : [ thisFacade._private.sessionToken, ids, deletionOptions ]
}
});
}
this.searchDeletions = function(criteria, fetchOptions) { this.searchDeletions = function(criteria, fetchOptions) {
var thisFacade = this; var thisFacade = this;
return thisFacade._private.ajaxRequest({ return thisFacade._private.ajaxRequest({
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment