Booked Scheduler Community Support
March 22, 2019, 03:48:30 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Booked 2.7 beta has been released!
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Setting prevent.clean.username isn't in option array inside LdapOptions class  (Read 835 times)
maluco-beleza
Newbie
*

Karma: 0
Posts: 1


« on: July 04, 2018, 12:47:38 PM »

The setting "prevent.clean.username" defined in the plugins/Authentication/Ldap/Ldap.config.php

Code:
$conf['settings']['prevent.clean.username'] = 'true';

is not being set to the private property $_options = array(); of the the LdapOptions class (plugins/Authentication/Ldap/LdapOptions.php).

So when the method CleanUsername() is called inside the Ldap class's method Validate($username, $password) (plugins/Authentication/Ldap/Ldap.php):
Code:
$username = $this->CleanUsername($username);

 the Username always is cleaned because the index $this->_options[LdapConfig::PREVENT_CLEAN_USERNAME] is null.

In order to fix it for me, I replaced the use of the $this->_options by $this->GetConfig:

Code:
public function CleanUsername()
    {
        $converter = new BooleanConverter();
        #REMOVED LINE: return !$converter->Convert($this->_options[LdapConfig::PREVENT_CLEAN_USERNAME]);
        return !$converter->Convert($this->GetConfig(LdapConfig::PREVENT_CLEAN_USERNAME));
    }

So now the setting prevent.clean.username is working fine.
I'm using Booked Scheduler v2.7.1.
« Last Edit: July 04, 2018, 12:49:42 PM by maluco-beleza » Logged
clarinet
Newbie
*

Karma: 0
Posts: 5


« Reply #1 on: January 18, 2019, 12:48:59 PM »

I have independently come to the same conclusion when trying to synchronize LDAP groups (see http://php.brickhost.com/forums/index.php?topic=16213.0). Neither the sync.groups attribute is processed correctly. Similar patch applies here.

Code:
--- LdapOptions.php.orig        2019-01-16 16:09:12.336523141 +0100
+++ LdapOptions.php     2019-01-16 16:09:20.991525735 +0100
@@ -156,7 +156,7 @@
      */
     public function SyncGroups()
     {
-        return $this->_options[LdapConfig::SYNC_GROUPS];
+        return $this->GetConfig(LdapConfig::SYNC_GROUPS, new BooleanConverter());
     }
 
     /**
@@ -164,8 +164,7 @@
      */
     public function CleanUsername()
     {
-        $converter = new BooleanConverter();
-        return !$converter->Convert($this->_options[LdapConfig::PREVENT_CLEAN_USERNAME]);
+        return !$this->GetConfig(LdapConfig::PREVENT_CLEAN_USERNAME, new BooleanConverter());
     }
 
 }
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2006-2007, Simple Machines Valid XHTML 1.0! Valid CSS!