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-11-10 07:19:17 +00:00
|
|
|
xtype: 'pmxDisplayEditField',
|
|
|
|
name: 'path',
|
2020-05-20 10:15:37 +00:00
|
|
|
fieldLabel: gettext('Path'),
|
2020-11-10 07:19:17 +00:00
|
|
|
editConfig: {
|
|
|
|
xtype: 'pbsPermissionPathSelector',
|
|
|
|
allowBlank: false,
|
|
|
|
},
|
2020-10-28 10:07:27 +00:00
|
|
|
editable: !me.path,
|
|
|
|
value: me.path,
|
|
|
|
});
|
|
|
|
|
|
|
|
if (me.aclType === 'user') {
|
|
|
|
me.subject = gettext('User Permission');
|
|
|
|
me.items.push({
|
|
|
|
xtype: 'pbsUserSelector',
|
2020-10-30 14:18:41 +00:00
|
|
|
name: 'auth-id',
|
2020-11-10 07:19:17 +00:00
|
|
|
fieldLabel: gettext('User'),
|
2020-10-28 10:07:27 +00:00
|
|
|
allowBlank: false,
|
|
|
|
});
|
|
|
|
} else if (me.aclType === 'token') {
|
|
|
|
me.subject = gettext('API Token Permission');
|
|
|
|
me.items.push({
|
|
|
|
xtype: 'pbsTokenSelector',
|
2020-10-30 14:18:41 +00:00
|
|
|
name: 'auth-id',
|
2020-11-10 07:19:17 +00:00
|
|
|
fieldLabel: gettext('API Token'),
|
2020-10-28 10:07:27 +00:00
|
|
|
allowBlank: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
me.items.push({
|
2020-05-20 10:15:37 +00:00
|
|
|
xtype: 'pmxRoleSelector',
|
|
|
|
name: 'role',
|
|
|
|
fieldLabel: gettext('Role'),
|
2020-11-10 07:19:17 +00:00
|
|
|
value: 'NoAccess',
|
2020-10-28 10:07:27 +00:00
|
|
|
});
|
|
|
|
me.items.push({
|
2020-05-20 10:15:37 +00:00
|
|
|
xtype: 'proxmoxcheckbox',
|
|
|
|
name: 'propagate',
|
2020-11-10 07:19:17 +00:00
|
|
|
fieldLabel: gettext('Propagate'),
|
2020-05-20 10:15:37 +00:00
|
|
|
checked: true,
|
|
|
|
uncheckedValue: 0,
|
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
|
|
|
});
|