]> git.proxmox.com Git - proxmox-backup.git/blob - www/window/ACLEdit.js
gui: add API token ACLs
[proxmox-backup.git] / www / window / ACLEdit.js
1 Ext.define('PBS.window.ACLEdit', {
2 extend: 'Proxmox.window.Edit',
3 alias: 'widget.pbsACLAdd',
4 mixins: ['Proxmox.Mixin.CBind'],
5
6 onlineHelp: 'user_acl',
7
8 url: '/access/acl',
9 method: 'PUT',
10 isAdd: true,
11 isCreate: true,
12 width: 450,
13
14 // caller can give a static path
15 path: undefined,
16
17 initComponent: function() {
18 let me = this;
19
20 me.items = [];
21
22 me.items.push({
23 xtype: 'pbsPermissionPathSelector',
24 fieldLabel: gettext('Path'),
25 editable: !me.path,
26 value: me.path,
27 name: 'path',
28 allowBlank: false,
29 });
30
31 if (me.aclType === 'user') {
32 me.subject = gettext('User Permission');
33 me.items.push({
34 xtype: 'pbsUserSelector',
35 fieldLabel: gettext('User'),
36 name: 'auth_id',
37 allowBlank: false,
38 });
39 } else if (me.aclType === 'token') {
40 me.subject = gettext('API Token Permission');
41 me.items.push({
42 xtype: 'pbsTokenSelector',
43 fieldLabel: gettext('API Token'),
44 name: 'auth_id',
45 allowBlank: false,
46 });
47 }
48 me.items.push({
49 xtype: 'pmxRoleSelector',
50 name: 'role',
51 value: 'NoAccess',
52 fieldLabel: gettext('Role'),
53 });
54 me.items.push({
55 xtype: 'proxmoxcheckbox',
56 name: 'propagate',
57 checked: true,
58 uncheckedValue: 0,
59 fieldLabel: gettext('Propagate'),
60 });
61
62 me.callParent();
63 },
64
65 getValues: function(dirtyOnly) {
66 let me = this;
67 let values = me.callParent(arguments);
68
69 if (me.path) {
70 values.path = me.path;
71 }
72 return values;
73 },
74
75 });