Add method to service

This commit is contained in:
brantje 2016-10-05 14:36:02 +02:00
parent f80263dff0
commit 6a38da7698
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F
2 changed files with 14 additions and 0 deletions

View file

@ -282,6 +282,8 @@ angular.module('passmanApp')
// To update a file you can use the FileService.updateFile
//@TODO Update revisions with new key (async)
// With CredentialService.getRevisions we can get the revisions.
// Then we can update them using CredentialService.updateRevision
var list = $scope.share_settings.credentialSharedWithUserAndGroup;
for (var i = 0; i < list.length; i++) {

View file

@ -139,6 +139,18 @@ angular.module('passmanApp')
}
});
},
updateRevision: function(revision){
var _revision = angular.copy(revision);
_revision.revision_data = window.btoa(_revision.revision_data);
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + id + '/revision/' + revision.id);
return $http.patch(queryUrl, revision).then(function (response) {
if (response.data) {
return response.data;
} else {
return response;
}
});
},
deleteRevision: function(credential_id, revision_id){
var queryUrl = OC.generateUrl('apps/passman/api/v2/credentials/' + credential_id + '/revision/' + revision_id);
return $http.delete(queryUrl).then(function (response) {