From 823c20bd841f07b38de2c064ddcacd4c1022a343 Mon Sep 17 00:00:00 2001 From: hkernbach Date: Mon, 9 Jan 2017 14:23:46 +0100 Subject: [PATCH] issue: #2181 --- .../APP/frontend/js/views/userPermissions.js | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js index 022d3b4bf9..23885d7f86 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js @@ -35,10 +35,37 @@ if (checked) { this.grantPermission(this.currentUser.get('user'), db); } else { - this.revokePermission(this.currentUser.get('user'), db); + if (db === '_system') { + // special case, ask if user really want to revoke persmission here + var buttons = []; var tableContent = []; + + tableContent.push( + window.modalView.createReadOnlyEntry( + 'db-system-revoke-button', + 'Caution', + 'You are removing your permissions to _system database. Really continue?', + undefined, + undefined, + false + ) + ); + buttons.push( + window.modalView.createSuccessButton('Revoke', this.revokePermission.bind(this, this.currentUser.get('user'), db)) + ); + buttons.push( + window.modalView.createCloseButton('Cancel', this.rollbackInputButton.bind(this, db)) + ); + window.modalView.show('modalTable.ejs', 'Revoke _system Database Permission', buttons, tableContent); + } else { + this.revokePermission(this.currentUser.get('user'), db); + } } }, + rollbackInputButton: function (name) { + $('input[name="' + name + '"').prop('checked', 'true'); + }, + grantPermission: function (user, db) { $.ajax({ type: 'PUT', @@ -56,6 +83,7 @@ url: arangoHelper.databaseUrl('/_api/user/' + encodeURIComponent(user) + '/database/' + encodeURIComponent(db)), contentType: 'application/json' }); + window.modalView.hide(); }, continueRender: function () {