|
1
|
|
|
/** |
|
2
|
|
|
* Nextcloud - passman |
|
3
|
|
|
* |
|
4
|
|
|
* @copyright Copyright (c) 2016, Sander Brand ([email protected]) |
|
5
|
|
|
* @copyright Copyright (c) 2016, Marcos Zuriaga Miguel ([email protected]) |
|
6
|
|
|
* @license GNU AGPL version 3 or any later version |
|
7
|
|
|
* |
|
8
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
9
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
10
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
11
|
|
|
* License, or (at your option) any later version. |
|
12
|
|
|
* |
|
13
|
|
|
* This program is distributed in the hope that it will be useful, |
|
14
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16
|
|
|
* GNU Affero General Public License for more details. |
|
17
|
|
|
* |
|
18
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
19
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
20
|
|
|
* |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
(function () { |
|
24
|
|
|
'use strict'; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @ngdoc function |
|
28
|
|
|
* @name passmanApp.controller:MainCtrl |
|
29
|
|
|
* @description |
|
30
|
|
|
* # MainCtrl |
|
31
|
|
|
* Controller of the passmanApp |
|
32
|
|
|
*/ |
|
33
|
|
|
angular.module('passmanApp') |
|
34
|
|
|
.controller('RequestDeleteCtrl', ['$scope', '$location', '$http', '$routeParams', 'VaultService', 'NotificationService', '$translate', |
|
35
|
|
|
function ($scope, $location, $http, $routeParams, VaultService, NotificationService, $translate) { |
|
36
|
|
|
$scope.reason = ''; |
|
37
|
|
|
VaultService.getVault({guid: $routeParams.vault_id}).then(function(vault){ |
|
38
|
|
|
$scope.pending_deletion = vault.delete_request_pending; |
|
39
|
|
|
}); |
|
40
|
|
|
|
|
41
|
|
|
$scope.requestDeletion = function () { |
|
42
|
|
|
var queryUrl = OC.generateUrl('apps/passman/admin/request-deletion/'+ $routeParams.vault_id); |
|
43
|
|
|
var params = { |
|
44
|
|
|
reason: $scope.reason |
|
45
|
|
|
}; |
|
46
|
|
|
|
|
47
|
|
|
$http.post(queryUrl, params).then(function () { |
|
48
|
|
|
NotificationService.showNotification($translate.instant('deletion.requested'), 5000); |
|
49
|
|
|
$location.path('#/'); |
|
50
|
|
|
}); |
|
51
|
|
|
}; |
|
52
|
|
|
|
|
53
|
|
|
$scope.removeRequestDeletion = function () { |
|
54
|
|
|
var queryUrl = OC.generateUrl('apps/passman/admin/request-deletion/' + $routeParams.vault_id); |
|
55
|
|
|
$http.delete(queryUrl).then(function () { |
|
56
|
|
|
NotificationService.showNotification($translate.instant('deletion.removed'), 5000); |
|
57
|
|
|
$location.path('#/'); |
|
58
|
|
|
}); |
|
59
|
|
|
}; |
|
60
|
|
|
}]); |
|
61
|
|
|
}()); |