aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblizzz <blizzz@owncloud.com>2012-12-12 16:59:43 -0800
committerblizzz <blizzz@owncloud.com>2012-12-12 16:59:43 -0800
commit680ff3a51b577fafec4a012385dba1292aaeea34 (patch)
treeb27b049507f6bb36744dc23de6e42459a13b6206
parent8686a448c738bf7b2b0264d79557b976b2dca478 (diff)
parentde34f771c22b9a54fa22d9c00741e362f47c852d (diff)
downloadnextcloud-server-680ff3a51b577fafec4a012385dba1292aaeea34.tar.gz
nextcloud-server-680ff3a51b577fafec4a012385dba1292aaeea34.zip
Merge pull request #584 from wardragon/ldap_access_userExists_fix
Really fix OCP\Share::shareItem with LDAP users
-rw-r--r--apps/user_ldap/lib/access.php6
-rw-r--r--lib/public/user.php6
-rw-r--r--lib/user.php7
3 files changed, 12 insertions, 7 deletions
diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 042076fe62e..00183ac181b 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -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;
}
@@ -881,4 +881,4 @@ abstract class Access {
return $pagedSearchOK;
}
-} \ No newline at end of file
+}
diff --git a/lib/public/user.php b/lib/public/user.php
index b320ce8ea0c..9e50115ab70 100644
--- a/lib/public/user.php
+++ b/lib/public/user.php
@@ -65,12 +65,12 @@ class User {
/**
* @brief check if a user exists
* @param string $uid the username
+ * @param string $excludingBackend (default none)
* @return boolean
*/
- public static function userExists( $uid ) {
- return \OC_USER::userExists( $uid );
+ public static function userExists( $uid, $excludingBackend = null ) {
+ return \OC_USER::userExists( $uid, $excludingBackend );
}
-
/**
* @brief Loggs the user out including all the session data
* @returns true
diff --git a/lib/user.php b/lib/user.php
index 94ea899b841..80f88ca7052 100644
--- a/lib/user.php
+++ b/lib/user.php
@@ -414,10 +414,15 @@ class OC_User {
/**
* @brief check if a user exists
* @param string $uid the username
+ * @param string $excludingBackend (default none)
* @return boolean
*/
- public static function userExists($uid) {
+ public static function userExists($uid, $excludingBackend=null) {
foreach(self::$_usedBackends as $backend) {
+ if (!is_null($excludingBackend) && !strcmp(get_class($backend),$excludingBackend)) {
+ OC_Log::write('OC_User', $excludingBackend . 'excluded from user existance check.', OC_Log::DEBUG);
+ continue;
+ }
$result=$backend->userExists($uid);
if($result===true) {
return true;