diff options
author | Arthur Schiwon <blizzz@owncloud.com> | 2014-10-07 17:28:09 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@owncloud.com> | 2014-10-07 17:28:09 +0200 |
commit | 3ff4c8e3fc5d6249b559b3cd1b4a01ba02bd5c34 (patch) | |
tree | 558cf987f1203143f94e2caa072474f00d359544 /apps/user_ldap/js | |
parent | efd940133b759fb30e7d150fdc147e6a7e4faa28 (diff) | |
download | nextcloud-server-3ff4c8e3fc5d6249b559b3cd1b4a01ba02bd5c34.tar.gz nextcloud-server-3ff4c8e3fc5d6249b559b3cd1b4a01ba02bd5c34.zip |
sets user filters to raw mode when marking user as experienced
Diffstat (limited to 'apps/user_ldap/js')
-rw-r--r-- | apps/user_ldap/js/experiencedAdmin.js | 59 | ||||
-rw-r--r-- | apps/user_ldap/js/settings.js | 6 |
2 files changed, 65 insertions, 0 deletions
diff --git a/apps/user_ldap/js/experiencedAdmin.js b/apps/user_ldap/js/experiencedAdmin.js new file mode 100644 index 00000000000..2d500f301b0 --- /dev/null +++ b/apps/user_ldap/js/experiencedAdmin.js @@ -0,0 +1,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](); + } + }; + + +}; diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index fd84ca1980b..5982d65ad6c 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -931,4 +931,10 @@ $(document).ready(function() { LdapConfiguration.refreshConfig(); } }); + + expAdminCB = $('#ldap_experienced_admin'); + LdapWizard.admin = new ExperiencedAdmin(LdapWizard, expAdminCB.is(':checked')); + expAdminCB.change(function() { + LdapWizard.admin.toggle($(this).is(':checked')); + }); }); |