summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-10-14 12:39:57 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-10-14 12:39:57 +0200
commit757f3205311e6839cc2f29d7a10852982fb1d4ad (patch)
tree4728ae9fb8382a7221c7ee65eab8578e2014ac49 /lib
parenta83e003ae3ac8eba78ebfaa4d185a674f502feea (diff)
parent13dd62f7b040fdd4d638a50ad687d908a09d9bc8 (diff)
downloadnextcloud-server-757f3205311e6839cc2f29d7a10852982fb1d4ad.tar.gz
nextcloud-server-757f3205311e6839cc2f29d7a10852982fb1d4ad.zip
Merge pull request #19580 from owncloud/issue-19399-remote-shares-case-sensitivity
Make sure that remote shares use the correct uid casing
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php8
-rw-r--r--lib/private/user/database.php32
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/base.php b/lib/base.php
index 12c23f5ce1b..5deba7866f3 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -608,6 +608,14 @@ class OC {
OC_User::useBackend(new OC_User_Database());
OC_Group::useBackend(new OC_Group_Database());
+ // Subscribe to the hook
+ \OCP\Util::connectHook(
+ '\OCA\Files_Sharing\API\Server2Server',
+ 'preLoginNameUsedAsUserName',
+ '\OC_User_Database',
+ 'preLoginNameUsedAsUserName'
+ );
+
//setup extra user backends
if (!self::checkUpgrade(false)) {
OC_User::setupBackends();
diff --git a/lib/private/user/database.php b/lib/private/user/database.php
index 081066398c0..3969b446071 100644
--- a/lib/private/user/database.php
+++ b/lib/private/user/database.php
@@ -295,6 +295,20 @@ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend {
}
/**
+ * returns the username for the given login name in the correct casing
+ *
+ * @param string $loginName
+ * @return string|false
+ */
+ public function loginName2UserName($loginName) {
+ if ($this->userExists($loginName)) {
+ return $this->cache[$loginName]['uid'];
+ }
+
+ return false;
+ }
+
+ /**
* Backend name to be shown in user management
* @return string the name of the backend to be shown
*/
@@ -302,4 +316,22 @@ class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend {
return 'Database';
}
+ public static function preLoginNameUsedAsUserName($param) {
+ if(!isset($param['uid'])) {
+ throw new \Exception('key uid is expected to be set in $param');
+ }
+
+ $backends = \OC::$server->getUserManager()->getBackends();
+ foreach ($backends as $backend) {
+ if ($backend instanceof \OC_User_Database) {
+ /** @var \OC_User_Database $backend */
+ $uid = $backend->loginName2UserName($param['uid']);
+ if ($uid !== false) {
+ $param['uid'] = $uid;
+ return;
+ }
+ }
+ }
+
+ }
}