summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/js/experiencedAdmin.js
blob: 2d500f301b02a1129c94eec9db4835b6c283cd60 (plain)
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
/**
 * Copyright (c) 2014, Arthur Schiwon <blizzz@owncloud.com>
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 */

/**
 * controls behaviour depend on whether the admin is experienced in LDAP or not.
 *
 * @class
 * @param {object} wizard the LDAP Wizard object
 * @param {boolean} initialState whether the admin is experienced or not
 */
function ExperiencedAdmin(wizard, initialState) {
	this.wizard = wizard;
	this.isExperienced = false;
}


/**
 * toggles whether the admin is an experienced one or not
 *
 * @param {boolean} whether the admin is experienced or not
 */
ExperiencedAdmin.prototype.toggle = function(isExperienced) {
	this.isExperienced = isExperienced;
	if(this.isExperienced) {
		this.enableRawMode();
	}
};

/**
* answers whether the admin is an experienced one or not
*
* @return {boolean} whether the admin is experienced or not
*/
ExperiencedAdmin.prototype.isExperienced = function() {
	return this.isExperienced;
};

/**
 * switches all LDAP filters from Assisted to Raw mode.
 */
ExperiencedAdmin.prototype.enableRawMode = function	() {
	containers = {
		'toggleRawUserFilter' : '#rawGroupFilterContainer',
		'toggleRawLoginFilter': '#rawLoginFilterContainer',
		'toggleRawUserFilter' : '#rawUserFilterContainer'
	};

//	containers.forEach(function(container, method) {
	for(method in containers) {
		if($(containers[method]).hasClass('invisible')) {
			this.wizard[method]();
		}
	};


};