diff options
author | brantje <brantje@gmail.com> | 2016-10-05 15:36:02 +0300 |
---|---|---|
committer | brantje <brantje@gmail.com> | 2016-10-05 15:36:02 +0300 |
commit | 6a38da7698977213841e7ec5cfde0b133f827e48 (patch) | |
tree | d25d6c2c375c5bac7d0c13e291c192893758ea4b | |
parent | f80263dff09d045459e2b64822109e34400dc23c (diff) |
Add method to service
-rw-r--r-- | js/app/controllers/share.js | 2 | ||||
-rw-r--r-- | js/app/services/credentialservice.js | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/js/app/controllers/share.js b/js/app/controllers/share.js index 9a61f189..8257c088 100644 --- a/js/app/controllers/share.js +++ b/js/app/controllers/share.js @@ -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++) { diff --git a/js/app/services/credentialservice.js b/js/app/services/credentialservice.js index 7fb793d8..9888aceb 100644 --- a/js/app/services/credentialservice.js +++ b/js/app/services/credentialservice.js @@ -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) { |