From 3e23f03e016611fbb77e51e1ddd7e1e0327f5b2c Mon Sep 17 00:00:00 2001 From: SteScho Date: Thu, 30 Jan 2014 09:31:00 +0100 Subject: Update auth.php In Novell eDir the group search returns strings, not arrays. Added if-statement which determines if the result is an array or an string. --- lib/plugins/authldap/auth.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/plugins/authldap') diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php index 31e2c5135..d9d4b3d20 100644 --- a/lib/plugins/authldap/auth.php +++ b/lib/plugins/authldap/auth.php @@ -143,6 +143,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { * @author Dan Allen * @author * @author Stephane Chazelas + * @author Steffen Schoch * * @param string $user * @param bool $inbind authldap specific, true if in bind phase @@ -241,8 +242,13 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { if(is_array($result)) foreach($result as $grp) { if(!empty($grp[$this->getConf('groupkey')][0])) { - $this->_debug('LDAP usergroup: '.htmlspecialchars($grp[$this->getConf('groupkey')][0]), 0, __LINE__, __FILE__); - $info['grps'][] = $grp[$this->getConf('groupkey')][0]; + if(is_array($grp[$this->getConf('groupkey')][0])) { + $this->_debug('LDAP usergroup: '.htmlspecialchars($grp[$this->getConf('groupkey')][0]), 0, __LINE__, __FILE__); + $info['grps'][] = $grp[$this->getConf('groupkey')][0]; + } else { + $this->_debug('LDAP usergroup: '.htmlspecialchars($grp[$this->getConf('groupkey')]), 0, __LINE__, __FILE__); + $info['grps'][] = $grp[$this->getConf('groupkey')]; + } } } } -- cgit v1.2.3 From 38e97ed02731b8126aff3d921ad82e72212129a2 Mon Sep 17 00:00:00 2001 From: SteScho Date: Mon, 3 Feb 2014 07:39:16 +0100 Subject: Update auth.php As suggested by @selfthinker --- lib/plugins/authldap/auth.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'lib/plugins/authldap') diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php index d9d4b3d20..98858cb40 100644 --- a/lib/plugins/authldap/auth.php +++ b/lib/plugins/authldap/auth.php @@ -242,13 +242,9 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin { if(is_array($result)) foreach($result as $grp) { if(!empty($grp[$this->getConf('groupkey')][0])) { - if(is_array($grp[$this->getConf('groupkey')][0])) { - $this->_debug('LDAP usergroup: '.htmlspecialchars($grp[$this->getConf('groupkey')][0]), 0, __LINE__, __FILE__); - $info['grps'][] = $grp[$this->getConf('groupkey')][0]; - } else { - $this->_debug('LDAP usergroup: '.htmlspecialchars($grp[$this->getConf('groupkey')]), 0, __LINE__, __FILE__); - $info['grps'][] = $grp[$this->getConf('groupkey')]; - } + $groupkey = (is_array($grp[$this->getConf('groupkey')][0])) ? $grp[$this->getConf('groupkey')][0] : $grp[$this->getConf('groupkey')]; + $this->_debug('LDAP usergroup: '.htmlspecialchars($groupkey), 0, __LINE__, __FILE__); + $info['grps'][] = $groupkey; } } } -- cgit v1.2.3