]> source.dussan.org Git - nextcloud-server.git/commitdiff
sets user filters to raw mode when marking user as experienced
authorArthur Schiwon <blizzz@owncloud.com>
Tue, 7 Oct 2014 15:28:09 +0000 (17:28 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Tue, 7 Oct 2014 15:28:09 +0000 (17:28 +0200)
apps/user_ldap/js/experiencedAdmin.js [new file with mode: 0644]
apps/user_ldap/js/settings.js
apps/user_ldap/settings.php

diff --git a/apps/user_ldap/js/experiencedAdmin.js b/apps/user_ldap/js/experiencedAdmin.js
new file mode 100644 (file)
index 0000000..2d500f3
--- /dev/null
@@ -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]();
+               }
+       };
+
+
+};
index fd84ca1980b2a2f89bc1c22f33bfb7a208e9edeb..5982d65ad6c2d0f85607244fc98bc9a009c1146c 100644 (file)
@@ -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'));
+       });
 });
index e7cdd0d926a338f4826f2bc07624fb5fc4a096e9..1e588b1cd8586adc0b76e60214b61e780048a196 100644 (file)
@@ -26,6 +26,7 @@
 OC_Util::checkAdminUser();
 
 OCP\Util::addScript('user_ldap', 'ldapFilter');
+OCP\Util::addScript('user_ldap', 'experiencedAdmin');
 OCP\Util::addScript('user_ldap', 'settings');
 OCP\Util::addScript('core', 'jquery.multiselect');
 OCP\Util::addStyle('user_ldap', 'settings');