]>
Commit | Line | Data |
---|---|---|
efff7eab DC |
1 | Ext.define('PVE.panel.LDAPInputPanel', { |
2 | extend: 'PVE.panel.AuthBase', | |
3 | xtype: 'pveAuthLDAPPanel', | |
4 | ||
5 | initComponent: function() { | |
6 | let me = this; | |
7 | ||
8 | if (me.type !== 'ldap') { | |
9 | throw 'invalid type'; | |
10 | } | |
11 | ||
12 | me.column1 = [ | |
13 | { | |
14 | xtype: 'textfield', | |
15 | name: 'base_dn', | |
16 | fieldLabel: gettext('Base Domain Name'), | |
17 | emptyText: 'CN=Users,DC=Company,DC=net', | |
18 | allowBlank: false, | |
19 | }, | |
20 | { | |
21 | xtype: 'textfield', | |
22 | name: 'user_attr', | |
23 | emptyText: 'uid / sAMAccountName', | |
24 | fieldLabel: gettext('User Attribute Name'), | |
25 | allowBlank: false, | |
26 | }, | |
27 | ]; | |
28 | ||
29 | me.column2 = [ | |
30 | { | |
31 | xtype: 'textfield', | |
32 | fieldLabel: gettext('Server'), | |
33 | name: 'server1', | |
34 | allowBlank: false, | |
35 | }, | |
36 | { | |
37 | xtype: 'proxmoxtextfield', | |
38 | fieldLabel: gettext('Fallback Server'), | |
39 | deleteEmpty: !me.isCreate, | |
40 | name: 'server2', | |
41 | }, | |
42 | { | |
43 | xtype: 'proxmoxintegerfield', | |
44 | name: 'port', | |
45 | fieldLabel: gettext('Port'), | |
46 | minValue: 1, | |
47 | maxValue: 65535, | |
48 | emptyText: gettext('Default'), | |
49 | submitEmptyText: false, | |
50 | }, | |
51 | { | |
52 | xtype: 'proxmoxcheckbox', | |
53 | fieldLabel: 'SSL', | |
54 | name: 'secure', | |
55 | uncheckedValue: 0, | |
56 | }, | |
57 | ]; | |
58 | ||
59 | me.callParent(); | |
60 | }, | |
61 | }); | |
822fb26d DC |
62 | |
63 | Ext.define('PVE.panel.LDAPSyncInputPanel', { | |
64 | extend: 'Proxmox.panel.InputPanel', | |
65 | xtype: 'pveAuthLDAPSyncPanel', | |
66 | ||
67 | editableAttributes: ['email'], | |
68 | editableDefaults: ['scope', 'full', 'enable-new', 'purge'], | |
69 | ||
70 | // (de)construct the sync-attributes from the list above, | |
71 | // not touching all others | |
72 | onGetValues: function(values) { | |
73 | let me = this; | |
74 | me.editableDefaults.forEach((attr) => { | |
75 | if (values[attr]) { | |
76 | me.default_opts[attr] = values[attr]; | |
77 | delete values[attr]; | |
78 | } else { | |
79 | delete me.default_opts[attr]; | |
80 | } | |
81 | }); | |
82 | values['sync-defaults-options'] = PVE.Parser.printPropertyString(me.default_opts); | |
83 | me.editableAttributes.forEach((attr) => { | |
84 | if (values[attr]) { | |
85 | me.sync_attributes[attr] = values[attr]; | |
86 | delete values[attr]; | |
87 | } else { | |
88 | delete me.sync_attributes[attr]; | |
89 | } | |
90 | }); | |
91 | values.sync_attributes = PVE.Parser.printPropertyString(me.sync_attributes); | |
92 | ||
93 | PVE.Utils.delete_if_default(values, 'sync-defaults-options'); | |
94 | PVE.Utils.delete_if_default(values, 'sync_attributes'); | |
95 | ||
96 | return values; | |
97 | }, | |
98 | ||
99 | setValues: function(values) { | |
100 | let me = this; | |
101 | me.sync_attributes = {}; | |
102 | if (values.sync_attributes) { | |
103 | me.sync_attributes = PVE.Parser.parsePropertyString(values.sync_attributes); | |
104 | delete values.sync_attributes; | |
105 | me.editableAttributes.forEach((attr) => { | |
106 | if (me.sync_attributes[attr]) { | |
107 | values[attr] = me.sync_attributes[attr]; | |
108 | } | |
109 | }); | |
110 | } | |
111 | me.default_opts = {}; | |
112 | if (values['sync-defaults-options']) { | |
113 | me.default_opts = PVE.Parser.parsePropertyString(values['sync-defaults-options']); | |
114 | delete values.default_opts; | |
115 | me.editableDefaults.forEach((attr) => { | |
116 | if (me.default_opts[attr]) { | |
117 | values[attr] = me.default_opts[attr]; | |
118 | } | |
119 | }); | |
120 | } | |
121 | return me.callParent([values]); | |
122 | }, | |
123 | ||
124 | column1: [ | |
125 | { | |
126 | xtype: 'proxmoxtextfield', | |
127 | name: 'bind_dn', | |
128 | deleteEmpty: true, | |
129 | emptyText: Proxmox.Utils.noneText, | |
130 | fieldLabel: gettext('Bind User'), | |
131 | }, | |
132 | { | |
133 | xtype: 'proxmoxtextfield', | |
134 | inputType: 'password', | |
135 | name: 'password', | |
136 | emptyText: gettext('Unchanged'), | |
137 | fieldLabel: gettext('Bind Password'), | |
138 | }, | |
139 | { | |
140 | xtype: 'proxmoxtextfield', | |
141 | name: 'email', | |
142 | fieldLabel: gettext('E-Mail attribute'), | |
143 | }, | |
144 | { | |
145 | xtype: 'proxmoxtextfield', | |
146 | name: 'group_name_attr', | |
147 | deleteEmpty: true, | |
148 | fieldLabel: gettext('Groupname attr.'), | |
149 | }, | |
150 | { | |
151 | xtype: 'displayfield', | |
152 | value: gettext('Default Sync Options'), | |
153 | }, | |
154 | { | |
155 | xtype: 'proxmoxKVComboBox', | |
156 | name: 'scope', | |
157 | emptyText: Proxmox.Utils.NoneText, | |
158 | fieldLabel: gettext('Scope'), | |
159 | value: '__default__', | |
160 | deleteEmpty: false, | |
161 | comboItems: [ | |
162 | ['__default__', Proxmox.Utils.NoneText], | |
163 | ['users', gettext('Users')], | |
164 | ['groups', gettext('Groups')], | |
165 | ['both', gettext('Users and Groups')], | |
166 | ], | |
167 | }, | |
168 | { | |
169 | xtype: 'proxmoxKVComboBox', | |
170 | value: '__default__', | |
171 | deleteEmpty: false, | |
172 | comboItems: [ | |
173 | ['__default__', Proxmox.Utils.NoneText], | |
174 | ['1', Proxmox.Utils.yesText], | |
175 | ['0', Proxmox.Utils.noText], | |
176 | ], | |
177 | name: 'full', | |
178 | fieldLabel: gettext('Full'), | |
179 | }, | |
180 | ], | |
181 | ||
182 | column2: [ | |
183 | { | |
184 | xtype: 'proxmoxtextfield', | |
185 | name: 'user_classes', | |
186 | fieldLabel: gettext('User classes'), | |
187 | deleteEmpty: true, | |
188 | emptyText: 'inetorgperson, posixaccount, person, user', | |
189 | }, | |
190 | { | |
191 | xtype: 'proxmoxtextfield', | |
192 | name: 'group_classes', | |
193 | fieldLabel: gettext('Group classes'), | |
194 | deleteEmpty: true, | |
195 | emptyText: 'groupOfNames, group, univentionGroup, ipausergroup', | |
196 | }, | |
197 | { | |
198 | xtype: 'proxmoxtextfield', | |
199 | name: 'filter', | |
200 | fieldLabel: gettext('User Filter'), | |
201 | deleteEmpty: true, | |
202 | }, | |
203 | { | |
204 | xtype: 'proxmoxtextfield', | |
205 | name: 'group_filter', | |
206 | fieldLabel: gettext('Group Filter'), | |
207 | deleteEmpty: true, | |
208 | }, | |
209 | { | |
210 | // fake for spacing | |
211 | xtype: 'displayfield', | |
212 | value: ' ', | |
213 | }, | |
214 | { | |
215 | xtype: 'proxmoxKVComboBox', | |
216 | value: '__default__', | |
217 | deleteEmpty: false, | |
218 | comboItems: [ | |
219 | [ | |
220 | '__default__', | |
221 | Ext.String.format( | |
222 | gettext("{0} ({1})"), | |
223 | Proxmox.Utils.yesText, | |
224 | Proxmox.Utils.defaultText, | |
225 | ), | |
226 | ], | |
227 | ['1', Proxmox.Utils.yesText], | |
228 | ['0', Proxmox.Utils.noText], | |
229 | ], | |
230 | name: 'enable-new', | |
231 | fieldLabel: gettext('Enable new users'), | |
232 | }, | |
233 | { | |
234 | xtype: 'proxmoxKVComboBox', | |
235 | value: '__default__', | |
236 | deleteEmpty: false, | |
237 | comboItems: [ | |
238 | ['__default__', Proxmox.Utils.NoneText], | |
239 | ['1', Proxmox.Utils.yesText], | |
240 | ['0', Proxmox.Utils.noText], | |
241 | ], | |
242 | name: 'purge', | |
243 | fieldLabel: gettext('Purge'), | |
244 | }, | |
245 | ], | |
246 | }); |