2020-05-20 10:15:37 +00:00
|
|
|
Ext.define('PBS.window.ACLEdit', {
|
|
|
|
extend: 'Proxmox.window.Edit',
|
|
|
|
alias: 'widget.pbsACLAdd',
|
|
|
|
mixins: ['Proxmox.Mixin.CBind'],
|
|
|
|
|
2020-09-21 11:25:48 +00:00
|
|
|
onlineHelp: 'user_acl',
|
|
|
|
|
2020-05-20 10:15:37 +00:00
|
|
|
url: '/access/acl',
|
|
|
|
method: 'PUT',
|
|
|
|
isAdd: true,
|
|
|
|
isCreate: true,
|
2020-07-25 18:10:06 +00:00
|
|
|
width: 450,
|
2020-05-20 10:15:37 +00:00
|
|
|
|
|
|
|
// caller can give a static path
|
|
|
|
path: undefined,
|
|
|
|
|
2020-10-28 10:07:27 +00:00
|
|
|
initComponent: function() {
|
2020-05-20 10:15:37 +00:00
|
|
|
let me = this;
|
|
|
|
|
2020-10-28 10:07:27 +00:00
|
|
|
me.items = [];
|
2020-05-20 10:15:37 +00:00
|
|
|
|
2020-10-28 10:07:27 +00:00
|
|
|
me.items.push({
|
2020-07-25 18:10:06 +00:00
|
|
|
xtype: 'pbsPermissionPathSelector',
|
2020-05-20 10:15:37 +00:00
|
|
|
fieldLabel: gettext('Path'),
|
2020-10-28 10:07:27 +00:00
|
|
|
editable: !me.path,
|
|
|
|
value: me.path,
|
2020-05-20 10:15:37 +00:00
|
|
|
name: 'path',
|
|
|
|
allowBlank: false,
|
2020-10-28 10:07:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
if (me.aclType === 'user') {
|
|
|
|
me.subject = gettext('User Permission');
|
|
|
|
me.items.push({
|
|
|
|
xtype: 'pbsUserSelector',
|
|
|
|
fieldLabel: gettext('User'),
|
|
|
|
name: 'auth_id',
|
|
|
|
allowBlank: false,
|
|
|
|
});
|
|
|
|
} else if (me.aclType === 'token') {
|
|
|
|
me.subject = gettext('API Token Permission');
|
|
|
|
me.items.push({
|
|
|
|
xtype: 'pbsTokenSelector',
|
|
|
|
fieldLabel: gettext('API Token'),
|
|
|
|
name: 'auth_id',
|
|
|
|
allowBlank: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
me.items.push({
|
2020-05-20 10:15:37 +00:00
|
|
|
xtype: 'pmxRoleSelector',
|
|
|
|
name: 'role',
|
|
|
|
value: 'NoAccess',
|
|
|
|
fieldLabel: gettext('Role'),
|
2020-10-28 10:07:27 +00:00
|
|
|
});
|
|
|
|
me.items.push({
|
2020-05-20 10:15:37 +00:00
|
|
|
xtype: 'proxmoxcheckbox',
|
|
|
|
name: 'propagate',
|
|
|
|
checked: true,
|
|
|
|
uncheckedValue: 0,
|
|
|
|
fieldLabel: gettext('Propagate'),
|
2020-10-28 10:07:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
me.callParent();
|
|
|
|
},
|
|
|
|
|
|
|
|
getValues: function(dirtyOnly) {
|
|
|
|
let me = this;
|
|
|
|
let values = me.callParent(arguments);
|
|
|
|
|
|
|
|
if (me.path) {
|
|
|
|
values.path = me.path;
|
|
|
|
}
|
|
|
|
return values;
|
|
|
|
},
|
|
|
|
|
2020-05-20 10:15:37 +00:00
|
|
|
});
|