1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
/**
* Copyright (c) 2015, Arthur Schiwon <blizzz@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
OCA = OCA || {};
(function() {
/**
* @classdesc This class represents the view belonging to the advanced tab
* in the LDAP wizard.
*/
var WizardTabAdvanced = OCA.LDAP.Wizard.WizardTabGeneric.subClass({
/**
* initializes the instance. Always call it after initialization.
*
* @param tabIndex
* @param tabID
*/
init: function (tabIndex, tabID) {
this._super(tabIndex, tabID);
var items = {
// Connection settings
ldap_configuration_active: {
$element: $('#ldap_configuration_active'),
setMethod: 'setConfigurationState'
},
ldap_backup_host: {
$element: $('#ldap_backup_host'),
setMethod: 'setBackupHost'
},
ldap_backup_port: {
$element: $('#ldap_backup_port'),
setMethod: 'setBackupPort'
},
ldap_override_main_server: {
$element: $('#ldap_override_main_server'),
setMethod: 'setOverrideMainServerState'
},
ldap_turn_off_cert_check: {
$element: $('#ldap_turn_off_cert_check'),
setMethod: 'setCertCheckDisabled'
},
ldap_cache_ttl: {
$element: $('#ldap_cache_ttl'),
setMethod: 'setCacheTTL'
},
//Directory Settings
ldap_display_name: {
$element: $('#ldap_display_name'),
setMethod: 'setUserDisplayName'
},
ldap_base_users: {
$element: $('#ldap_base_users'),
setMethod: 'setBaseDNUsers'
},
ldap_attributes_for_user_search: {
$element: $('#ldap_attributes_for_user_search'),
setMethod: 'setSearchAttributesUsers'
},
ldap_group_display_name: {
$element: $('#ldap_group_display_name'),
setMethod: 'setGroupDisplayName'
},
ldap_base_groups: {
$element: $('#ldap_base_groups'),
setMethod: 'setBaseDNGroups'
},
ldap_attributes_for_group_search: {
$element: $('#ldap_attributes_for_group_search'),
setMethod: 'setSearchAttributesGroups'
},
ldap_group_member_assoc_attribute: {
$element: $('#ldap_group_member_assoc_attribute'),
setMethod: 'setGroupMemberAssociationAttribute'
},
ldap_nested_groups: {
$element: $('#ldap_nested_groups'),
setMethod: 'setUseNestedGroups'
},
ldap_paging_size: {
$element: $('#ldap_paging_size'),
setMethod: 'setPagingSize'
},
//Special Attributes
ldap_quota_attr: {
$element: $('#ldap_quota_attr'),
setMethod: 'setQuotaAttribute'
},
ldap_quota_def: {
$element: $('#ldap_quota_def'),
setMethod: 'setQuotaDefault'
},
ldap_email_attr: {
$element: $('#ldap_email_attr'),
setMethod: 'setEmailAttribute'
},
home_folder_naming_rule: {
$element: $('#home_folder_naming_rule'),
setMethod: 'setHomeFolderAttribute'
}
};
this.setManagedItems(items);
},
/**
* Sets the config model for this view and subscribes to some events.
* Also binds the config chooser to the model
*
* @param {OCA.LDAP.Wizard.ConfigModel} configModel
*/
setModel: function(configModel) {
this._super(configModel);
this.configModel.on('configLoaded', this.onConfigLoaded, this);
this.configModel.on('receivedLdapFeature', this.onResultReceived, this);
},
/**
* updates the experienced admin check box
*
* @param {string} isConfigActive contains an int
*/
setConfigurationState: function(isConfigActive) {
this.setElementValue(
this.managedItems.ldap_configuration_active.$element, isConfigActive
);
},
/**
* updates the backup host configuration text field
*
* @param {string} host
*/
setBackupHost: function(host) {
this.setElementValue(this.managedItems.ldap_backup_host.$element, host);
},
/**
* updates the backup port configuration text field
*
* @param {string} port
*/
setBackupPort: function(port) {
this.setElementValue(this.managedItems.ldap_backup_port.$element, port);
},
/**
* sets whether the main server should be overridden or not
*
* @param {string} doOverride contains an int
*/
setOverrideMainServerState: function(doOverride) {
this.setElementValue(
this.managedItems.ldap_override_main_server.$element, doOverride
);
},
/**
* sets whether the SSL/TLS certification check shout be disabled
*
* @param {string} doCertCheck contains an int
*/
setCertCheckDisabled: function(doCertCheck) {
this.setElementValue(
this.managedItems.ldap_turn_off_cert_check.$element, doCertCheck
);
},
/**
* sets the time-to-live of the LDAP cache (in seconds)
*
* @param {string} cacheTTL contains an int
*/
setCacheTTL: function(cacheTTL) {
this.setElementValue(this.managedItems.ldap_cache_ttl.$element, cacheTTL);
},
/**
* sets the user display name attribute
*
* @param {string} attribute
*/
setUserDisplayName: function(attribute) {
this.setElementValue(this.managedItems.ldap_display_name.$element, attribute);
},
/**
* sets the Base DN for users
*
* @param {string} base
*/
setBaseDNUsers: function(base) {
this.setElementValue(this.managedItems.ldap_base_users.$element, base);
},
/**
* sets the attributes for user searches
*
* @param {string} attributes
*/
setSearchAttributesUsers: function(attributes) {
this.setElementValue(this.managedItems.ldap_attributes_for_user_search.$element, attributes);
},
/**
* sets the display name attribute for groups
*
* @param {string} attribute
*/
setGroupDisplayName: function(attribute) {
this.setElementValue(this.managedItems.ldap_group_display_name.$element, attribute);
},
/**
* sets the Base DN for groups
*
* @param {string} base
*/
setBaseDNGroups: function(base) {
this.setElementValue(this.managedItems.ldap_base_groups.$element, base);
},
/**
* sets the attributes for group search
*
* @param {string} attributes
*/
setSearchAttributesGroups: function(attributes) {
this.setElementValue(this.managedItems.ldap_attributes_for_group_search.$element, attributes);
},
/**
* sets the attribute for the association of users and groups
*
* @param {string} attribute
*/
setGroupMemberAssociationAttribute: function(attribute) {
this.setElementValue(this.managedItems.ldap_group_member_assoc_attribute.$element, attribute);
},
/**
* enabled or disables the use of nested groups (groups in groups in
* groups…)
*
* @param {string} useNestedGroups contains an int
*/
setUseNestedGroups: function(useNestedGroups) {
this.setElementValue(this.managedItems.ldap_nested_groups.$element, useNestedGroups);
},
/**
* sets the size of pages for paged search
*
* @param {string} size contains an int
*/
setPagingSize: function(size) {
this.setElementValue(this.managedItems.ldap_paging_size.$element, size);
},
/**
* sets the email attribute
*
* @param {string} attribute
*/
setEmailAttribute: function(attribute) {
this.setElementValue(this.managedItems.ldap_email_attr.$element, attribute);
},
/**
* sets the quota attribute
*
* @param {string} attribute
*/
setQuotaAttribute: function(attribute) {
this.setElementValue(this.managedItems.ldap_quota_attr.$element, attribute);
},
/**
* sets the default quota for LDAP users
*
* @param {string} quota contains an int
*/
setQuotaDefault: function(quota) {
this.setElementValue(this.managedItems.ldap_quota_def.$element, quota);
},
/**
* sets the attribute for the ownCloud user specific home folder location
*
* @param {string} attribute
*/
setHomeFolderAttribute: function(attribute) {
this.setElementValue(this.managedItems.home_folder_naming_rule.$element, attribute);
},
/**
* deals with the result of the Test Connection test
*
* @param {WizardTabAdvanced} view
* @param {FeaturePayload} payload
*/
onResultReceived: function(view, payload) {
if(payload.feature === 'TestConfiguration') {
OC.Notification.showTemporary(payload.data.message);
}
}
});
OCA.LDAP.Wizard.WizardTabAdvanced = WizardTabAdvanced;
})();
|