mirror of
https://github.com/nextcloud/passman.git
synced 2024-11-13 03:18:54 +08:00
hide credential edit files tab for shared credentials with missing FILES acl #815
This commit is contained in:
parent
6718289108
commit
611e7aa069
3 changed files with 17 additions and 4 deletions
|
@ -32,8 +32,8 @@
|
|||
* Controller of the passmanApp
|
||||
*/
|
||||
angular.module('passmanApp')
|
||||
.controller('CredentialEditCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'FileService', 'EncryptService', 'TagService', 'NotificationService', 'ShareService', '$translate','$rootScope',
|
||||
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService, ShareService, $translate, $rootScope) {
|
||||
.controller('CredentialEditCtrl', ['$scope', 'VaultService', 'CredentialService', 'SettingsService', '$location', '$routeParams', 'FileService', 'EncryptService', 'TagService', 'NotificationService', 'ShareService', 'SharingACL', '$translate','$rootScope',
|
||||
function ($scope, VaultService, CredentialService, SettingsService, $location, $routeParams, FileService, EncryptService, TagService, NotificationService, ShareService, SharingACL, $translate, $rootScope) {
|
||||
$scope.active_vault = VaultService.getActiveVault();
|
||||
if (!SettingsService.getSetting('defaultVault') || !SettingsService.getSetting('defaultVaultPass')) {
|
||||
if (!$scope.active_vault) {
|
||||
|
@ -89,7 +89,8 @@
|
|||
}, {
|
||||
title: translations.files,
|
||||
url: 'views/partials/forms/edit_credential/files.html',
|
||||
color: 'yellow'
|
||||
color: 'yellow',
|
||||
requiredACL: $scope.permissions.permissions.FILES
|
||||
}, {
|
||||
title: translations.otp,
|
||||
url: 'views/partials/forms/edit_credential/otp.html',
|
||||
|
@ -135,6 +136,17 @@
|
|||
return tab.url === $scope.currentTab.url;
|
||||
};
|
||||
|
||||
$scope.permissions = new SharingACL(0);
|
||||
|
||||
$scope.hasPermission = function (acl, permission) {
|
||||
if (acl) {
|
||||
var tmp = new SharingACL(acl.permission);
|
||||
return tmp.hasPermission(permission);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Below general edit functions
|
||||
*/
|
||||
|
|
|
@ -9,7 +9,7 @@ angular.module('views/credential_revisions.html', []).run(['$templateCache', fun
|
|||
angular.module('views/edit_credential.html', []).run(['$templateCache', function($templateCache) {
|
||||
'use strict';
|
||||
$templateCache.put('views/edit_credential.html',
|
||||
'<div id="passman-controls"><div class="breadcrumb"><ul class="breadcrumb"><li class="crumb svg crumbhome"><a ng-click="logout()" class="icon-home">Home</a> <span style="display: none;"></span></li><li class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{ active_vault.name }}</a></li><li class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">{{ \'edit.credential\' | translate }} "{{ storedCredential.label }}"</a> <a ng-if="!storedCredential.credential_id">{{ \'create.credential\' | translate }}</a></li></ul></div></div><div class="app-sidebar-tabs"><nav class="app-sidebar-tabs__nav"><ul><li ng-repeat="tab in tabs track by $index" class="app-sidebar-tabs__tab" ng-class="isActiveTab(tab)? \'active\' : \'inactive\'" ng-click="onClickTab(tab)">{{ tab.title }}</li></ul></nav><div class="tab_container edit_credential" use-theme type="\'border-top-color\'"><div ng-include="currentTab.url"></div><button ng-click="saveCredential()" ng-disabled="saving"><i class="fa fa-spinner fa-spin" ng-show="saving"></i> {{ \'save\' | translate }}</button> <button ng-click="cancel()">{{ \'cancel\' | translate }}</button></div></div>');
|
||||
'<div id="passman-controls"><div class="breadcrumb"><ul class="breadcrumb"><li class="crumb svg crumbhome"><a ng-click="logout()" class="icon-home">Home</a> <span style="display: none;"></span></li><li class="crumb svg" data-dir="/Test"><a ng-click="cancel()">{{ active_vault.name }}</a></li><li class="crumb svg last" data-dir="/Test"><a ng-if="storedCredential.credential_id">{{ \'edit.credential\' | translate }} "{{ storedCredential.label }}"</a> <a ng-if="!storedCredential.credential_id">{{ \'create.credential\' | translate }}</a></li></ul></div></div><div class="app-sidebar-tabs"><nav class="app-sidebar-tabs__nav"><ul><li ng-repeat="tab in tabs track by $index" class="app-sidebar-tabs__tab" ng-if="tab.requiredACL == undefined || storedCredential.acl == undefined || hasPermission(storedCredential.acl.permissions, tab.requiredACL)" ng-class="isActiveTab(tab)? \'active\' : \'inactive\'" ng-click="onClickTab(tab)">{{ tab.title }}</li></ul></nav><div class="tab_container edit_credential" use-theme type="\'border-top-color\'"><div ng-include="currentTab.url"></div><button ng-click="saveCredential()" ng-disabled="saving"><i class="fa fa-spinner fa-spin" ng-show="saving"></i> {{ \'save\' | translate }}</button> <button ng-click="cancel()">{{ \'cancel\' | translate }}</button></div></div>');
|
||||
}]);
|
||||
|
||||
angular.module('views/partials/credential_template.html', []).run(['$templateCache', function($templateCache) {
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<nav class="app-sidebar-tabs__nav">
|
||||
<ul>
|
||||
<li ng-repeat="tab in tabs track by $index" class="app-sidebar-tabs__tab"
|
||||
ng-if="tab.requiredACL == undefined || storedCredential.acl == undefined || hasPermission(storedCredential.acl.permissions, tab.requiredACL)"
|
||||
ng-class="isActiveTab(tab)? 'active' : 'inactive'"
|
||||
ng-click="onClickTab(tab)">{{ tab.title }}
|
||||
</li>
|
||||
|
|
Loading…
Reference in a new issue