diff options
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/appinfo/app.php | 3 | ||||
-rw-r--r-- | apps/user_ldap/appinfo/info.xml | 4 | ||||
-rw-r--r-- | apps/user_ldap/css/settings.css | 5 | ||||
-rw-r--r-- | apps/user_ldap/lib/access.php | 32 | ||||
-rw-r--r-- | apps/user_ldap/lib/connection.php | 8 | ||||
-rw-r--r-- | apps/user_ldap/templates/settings.php | 7 |
6 files changed, 38 insertions, 21 deletions
diff --git a/apps/user_ldap/appinfo/app.php b/apps/user_ldap/appinfo/app.php index 0eec7829a4a..ce3079da0ba 100644 --- a/apps/user_ldap/appinfo/app.php +++ b/apps/user_ldap/appinfo/app.php @@ -42,3 +42,6 @@ $entry = array( ); OCP\Backgroundjob::addRegularTask('OCA\user_ldap\lib\Jobs', 'updateGroups'); +if(OCP\App::isEnabled('user_webdavauth')) { + OCP\Util::writeLog('user_ldap', 'user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour', OCP\Util::WARN); +} diff --git a/apps/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml index 30fbf687dbe..a7605775274 100644 --- a/apps/user_ldap/appinfo/info.xml +++ b/apps/user_ldap/appinfo/info.xml @@ -2,7 +2,9 @@ <info> <id>user_ldap</id> <name>LDAP user and group backend</name> - <description>Authenticate Users by LDAP</description> + <description>Authenticate users and groups by LDAP resp. Active Directoy. + + This app is not compatible to the WebDAV user backend.</description> <licence>AGPL</licence> <author>Dominik Schmidt and Arthur Schiwon</author> <require>4.9</require> diff --git a/apps/user_ldap/css/settings.css b/apps/user_ldap/css/settings.css index 30c5c175c9b..f3f41fb2d8b 100644 --- a/apps/user_ldap/css/settings.css +++ b/apps/user_ldap/css/settings.css @@ -7,4 +7,9 @@ #ldap fieldset input { width: 70%; display: inline-block; +} + +.ldapwarning { + margin-left: 1.4em; + color: #FF3B3B; }
\ No newline at end of file diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 042076fe62e..f888577aedb 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -133,7 +133,7 @@ abstract class Access { '\"' => '\5c22', '\#' => '\5c23', ); - $dn = str_replace(array_keys($replacements),array_values($replacements), $dn); + $dn = str_replace(array_keys($replacements), array_values($replacements), $dn); return $dn; } @@ -288,8 +288,8 @@ abstract class Access { } $ldapname = $this->sanitizeUsername($ldapname); - //a new user/group! Then let's try to add it. We're shooting into the blue with the user/group name, assuming that in most cases there will not be a conflict. Otherwise an error will occur and we will continue with our second shot. - if(($isUser && !\OCP\User::userExists($ldapname)) || (!$isUser && !\OC_Group::groupExists($ldapname))) { + //a new user/group! Add it only if it doesn't conflict with other backend's users or existing groups + if(($isUser && !\OCP\User::userExists($ldapname, 'OCA\\user_ldap\\USER_LDAP')) || (!$isUser && !\OC_Group::groupExists($ldapname))) { if($this->mapComponent($dn, $ldapname, $isUser)) { return $ldapname; } @@ -347,20 +347,20 @@ abstract class Access { } private function findMappedGroup($dn) { - static $query = null; + static $query = null; if(is_null($query)) { $query = \OCP\DB::prepare(' - SELECT `owncloud_name` - FROM `'.$this->getMapTable(false).'` - WHERE `ldap_dn` = ?' - ); - } - $res = $query->execute(array($dn))->fetchOne(); - if($res) { - return $res; - } + SELECT `owncloud_name` + FROM `'.$this->getMapTable(false).'` + WHERE `ldap_dn` = ?' + ); + } + $res = $query->execute(array($dn))->fetchOne(); + if($res) { + return $res; + } return false; - } + } private function ldap2ownCloudNames($ldapObjects, $isUsers) { @@ -619,7 +619,7 @@ abstract class Access { //a) paged search insuccessful, though attempted //b) no paged search, but limit set if((!$this->pagedSearchedSuccessful - && $pagedSearchOK) + && $pagedSearchOK) || ( !$pagedSearchOK && !is_null($limit) @@ -881,4 +881,4 @@ abstract class Access { return $pagedSearchOK; } -}
\ No newline at end of file +} diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php index 687e2692270..b14cdafff89 100644 --- a/apps/user_ldap/lib/connection.php +++ b/apps/user_ldap/lib/connection.php @@ -338,11 +338,11 @@ class Connection { } $this->ldapConnectionRes = ldap_connect($this->config['ldapHost'], $this->config['ldapPort']); if(ldap_set_option($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) { - if(ldap_set_option($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) { - if($this->config['ldapTLS']) { - ldap_start_tls($this->ldapConnectionRes); - } + if(ldap_set_option($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) { + if($this->config['ldapTLS']) { + ldap_start_tls($this->ldapConnectionRes); } + } } return $this->bind(); diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index d10062c1d9d..8522d2f835c 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -4,6 +4,13 @@ <li><a href="#ldapSettings-1">LDAP Basic</a></li> <li><a href="#ldapSettings-2">Advanced</a></li> </ul> + <?php if(OCP\App::isEnabled('user_webdavauth')) { + echo '<p class="ldapwarning">'.$l->t('<b>Warning:</b> Apps user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour. Please ask your system administrator to disable one of them.').'</p>'; + } + if(!function_exists('ldap_connect')) { + echo '<p class="ldapwarning">'.$l->t('<b>Warning:</b> The PHP LDAP module needs is not installed, the backend will not work. Please ask your system administrator to install it.').'</p>'; + } + ?> <fieldset id="ldapSettings-1"> <p><label for="ldap_host"><?php echo $l->t('Host');?></label><input type="text" id="ldap_host" name="ldap_host" value="<?php echo $_['ldap_host']; ?>" title="<?php echo $l->t('You can omit the protocol, except you require SSL. Then start with ldaps://');?>"></p> <p><label for="ldap_base"><?php echo $l->t('Base DN');?></label><input type="text" id="ldap_base" name="ldap_base" value="<?php echo $_['ldap_base']; ?>" title="<?php echo $l->t('You can specify Base DN for users and groups in the Advanced tab');?>" /></p> |