diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-12-12 17:25:03 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-12-19 10:17:17 +0100 |
commit | 6da33e1ea7bb340e22330941d2a980a1414210b0 (patch) | |
tree | 3717d08e21cb02a149ae109f4efeecb83ba582c1 /lib/private/user | |
parent | 5c6e08213e6ed52517f9f729ae91a2973f09c182 (diff) | |
download | nextcloud-server-6da33e1ea7bb340e22330941d2a980a1414210b0.tar.gz nextcloud-server-6da33e1ea7bb340e22330941d2a980a1414210b0.zip |
introduce names for user backends - IUserBackend
* LDAP with multiple servers also proved backendName
Diffstat (limited to 'lib/private/user')
-rw-r--r-- | lib/private/user/database.php | 10 | ||||
-rw-r--r-- | lib/private/user/dummy.php | 10 | ||||
-rw-r--r-- | lib/private/user/http.php | 10 | ||||
-rw-r--r-- | lib/private/user/manager.php | 11 | ||||
-rw-r--r-- | lib/private/user/user.php | 3 |
5 files changed, 38 insertions, 6 deletions
diff --git a/lib/private/user/database.php b/lib/private/user/database.php index a6289066f05..de6c72e4745 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -36,7 +36,7 @@ /** * Class for user management in a SQL Database (e.g. MySQL, SQLite) */ -class OC_User_Database extends OC_User_Backend { +class OC_User_Database extends OC_User_Backend implements \OCP\IUserBackend { private $cache = array(); /** @@ -260,4 +260,12 @@ class OC_User_Database extends OC_User_Backend { return $result->fetchOne(); } + /** + * Backend name to be shown in user management + * @return string the name of the backend to be shown + */ + public function getBackendName(){ + return 'Database'; + } + } diff --git a/lib/private/user/dummy.php b/lib/private/user/dummy.php index fd0201734fa..322a4562ee6 100644 --- a/lib/private/user/dummy.php +++ b/lib/private/user/dummy.php @@ -24,7 +24,7 @@ /** * dummy user backend, does not keep state, only for testing use */ -class OC_User_Dummy extends OC_User_Backend { +class OC_User_Dummy extends OC_User_Backend implements \OCP\IUserBackend { private $users = array(); private $displayNames = array(); @@ -156,4 +156,12 @@ class OC_User_Dummy extends OC_User_Backend { public function getDisplayName($uid) { return isset($this->displayNames[$uid])? $this->displayNames[$uid]: $uid; } + + /** + * Backend name to be shown in user management + * @return string the name of the backend to be shown + */ + public function getBackendName(){ + return 'Dummy'; + } } diff --git a/lib/private/user/http.php b/lib/private/user/http.php index 617e8adb3f2..8375c4e1e22 100644 --- a/lib/private/user/http.php +++ b/lib/private/user/http.php @@ -24,7 +24,7 @@ /** * user backend using http auth requests */ -class OC_User_HTTP extends OC_User_Backend { +class OC_User_HTTP extends OC_User_Backend implements \OCP\IUserBackend { /** * split http://user@host/path into a user and url part * @param string $url @@ -109,4 +109,12 @@ class OC_User_HTTP extends OC_User_Backend { return false; } } + + /** + * Backend name to be shown in user management + * @return string the name of the backend to be shown + */ + public function getBackendName(){ + return 'HTTP'; + } } diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php index 2c56ea261d6..1fc89f8c2c2 100644 --- a/lib/private/user/manager.php +++ b/lib/private/user/manager.php @@ -279,10 +279,15 @@ class Manager extends PublicEmitter implements IUserManager { if ($backend->implementsActions(\OC_User_Backend::COUNT_USERS)) { $backendusers = $backend->countUsers(); if($backendusers !== false) { - if(isset($userCountStatistics[get_class($backend)])) { - $userCountStatistics[get_class($backend)] += $backendusers; + if($backend instanceof \OCP\IUserBackend) { + $name = $backend->getBackendName(); } else { - $userCountStatistics[get_class($backend)] = $backendusers; + $name = get_class($backend); + } + if(isset($userCountStatistics[$name])) { + $userCountStatistics[$name] += $backendusers; + } else { + $userCountStatistics[$name] = $backendusers; } } } diff --git a/lib/private/user/user.php b/lib/private/user/user.php index 062081d51d4..0b4f9a24276 100644 --- a/lib/private/user/user.php +++ b/lib/private/user/user.php @@ -225,6 +225,9 @@ class User implements IUser { * @return string */ public function getBackendClassName() { + if($this->backend instanceof \OCP\IUserBackend) { + return $this->backend->getBackendName(); + } return get_class($this->backend); } |