proxmox-backup/www/window/ACLEdit.js
Thomas Lamprecht 33612525e1 ui: datastore permissions: allow ACL path edit & query namespaces
Without namespaces this had not much use, but now that we can have
permissions below we should allow so.

For convenience also query the namsepaces here and add them to the
list of available ACL paths, the read-dir shouldn't be that expensive
(albeit, we could cache them in the frontend)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-18 18:14:37 +02:00

67 lines
1.4 KiB
JavaScript

Ext.define('PBS.window.ACLEdit', {
extend: 'Proxmox.window.Edit',
alias: 'widget.pbsACLAdd',
mixins: ['Proxmox.Mixin.CBind'],
onlineHelp: 'user_acl',
url: '/access/acl',
method: 'PUT',
isAdd: true,
isCreate: true,
width: 450,
// caller can give a static path
path: undefined,
defaultFocus: 'proxmoxcheckbox',
initComponent: function() {
let me = this;
me.items = [];
me.items.push({
xtype: 'pbsPermissionPathSelector',
name: 'path',
fieldLabel: gettext('Path'),
allowBlank: false,
//editable: !me.path,
value: me.path,
datastore: me.datastore,
});
if (me.aclType === 'user') {
me.subject = gettext('User Permission');
me.items.push({
xtype: 'pmxUserSelector',
name: 'auth-id',
fieldLabel: gettext('User'),
allowBlank: false,
});
} else if (me.aclType === 'token') {
me.subject = gettext('API Token Permission');
me.items.push({
xtype: 'pbsTokenSelector',
name: 'auth-id',
fieldLabel: gettext('API Token'),
allowBlank: false,
});
}
me.items.push({
xtype: 'pmxRoleSelector',
name: 'role',
fieldLabel: gettext('Role'),
value: 'NoAccess',
});
me.items.push({
xtype: 'proxmoxcheckbox',
name: 'propagate',
fieldLabel: gettext('Propagate'),
checked: true,
uncheckedValue: 0,
});
me.callParent();
},
});