1
0
Fork 0
This commit is contained in:
hkernbach 2017-01-09 14:23:46 +01:00
parent fc1b913791
commit 823c20bd84
1 changed files with 29 additions and 1 deletions

View File

@ -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 () {