diff options
-rw-r--r-- | lib/public/user.php | 10 | ||||
-rw-r--r-- | lib/user.php | 18 | ||||
-rw-r--r-- | lib/user/backend.php | 15 | ||||
-rw-r--r-- | settings/users.php | 15 |
4 files changed, 53 insertions, 5 deletions
diff --git a/lib/public/user.php b/lib/public/user.php index 2d22bdd96c8..3a2f4d02f5c 100644 --- a/lib/public/user.php +++ b/lib/public/user.php @@ -60,6 +60,16 @@ class User { return \OC_USER::getDisplayName();
} + /**
+ * @brief Get a list of all display names
+ * @returns array with all display names and the correspondig uids
+ *
+ * Get a list of all display names.
+ */
+ public static function getDisplayNames($search = '', $limit = null, $offset = null) {
+ return \OC_USER::getDisplayNames($search, $limit, $offset);
+ } + /** * @brief Check if the user is logged in * @returns true/false diff --git a/lib/user.php b/lib/user.php index f9c8f48568e..f84b4c01df7 100644 --- a/lib/user.php +++ b/lib/user.php @@ -457,6 +457,24 @@ class OC_User { asort($users); return $users; } + + /**
+ * @brief Get a list of all users display name
+ * @returns associative array with all display names and corresponding uids
+ *
+ * Get a list of all users.
+ */
+ public static function getDisplayNames($search = '', $limit = null, $offset = null) {
+ $displayNames = array();
+ foreach (self::$_usedBackends as $backend) {
+ $backendDisplayNames = $backend->getDisplayNames($search, $limit, $offset);
+ if (is_array($backendDisplayNames)) {
+ $displayNames = array_merge($displayNames, $backendDisplayNames);
+ }
+ }
+ ksort($displayNames);
+ return $displayNames;
+ } /** * @brief check if a user exists diff --git a/lib/user/backend.php b/lib/user/backend.php index 47c92f5fe7b..5823e390406 100644 --- a/lib/user/backend.php +++ b/lib/user/backend.php @@ -131,4 +131,19 @@ abstract class OC_User_Backend implements OC_User_Interface { public function getDisplayName($uid) { return $uid; } + + /**
+ * @brief Get a list of all display names
+ * @returns array with all displayNames and the correspondig uids
+ *
+ * Get a list of all display names.
+ */
+ public function getDisplayNames($search = '', $limit = null, $offset = null) {
+ $displayNames = array(); + $users = $this->getUsers($search, $limit, $offset); + foreach ( $users as $user) { + $displayNames[$user] = $user; + } + return $displayNames;
+ } } diff --git a/settings/users.php b/settings/users.php index 668d974693a..3706dc918c0 100644 --- a/settings/users.php +++ b/settings/users.php @@ -22,7 +22,7 @@ $isadmin = OC_User::isAdminUser(OC_User::getUser()); if($isadmin) { $accessiblegroups = OC_Group::getGroups(); - $accessibleusers = OC_User::getUsers('', 30); + $accessibleusers = OC_User::getDisplayNames('', 30); $subadmins = OC_SubAdmin::getAllSubAdmins(); }else{ $accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()); @@ -42,16 +42,21 @@ $defaultQuota=OC_Appconfig::getValue('files', 'default_quota', 'none'); $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false && array_search($defaultQuota, array('none', 'default'))===false; // load users and quota -foreach($accessibleusers as $i) { +foreach($accessibleusers as $displayName => $uid) { $quota=OC_Preferences::getValue($i, 'files', 'quota', 'default'); $isQuotaUserDefined=array_search($quota, $quotaPreset)===false && array_search($quota, array('none', 'default'))===false; + $name = $displayName; + if ( $displayName != $uid ) { + $name = $name . ' ('.$uid.')'; + } + $users[] = array( - "name" => $i, - "groups" => join( ", ", /*array_intersect(*/OC_Group::getUserGroups($i)/*, OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()))*/), + "name" => $name, + "groups" => join( ", ", /*array_intersect(*/OC_Group::getUserGroups($uid)/*, OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()))*/), 'quota'=>$quota, 'isQuotaUserDefined'=>$isQuotaUserDefined, - 'subadmin'=>implode(', ', OC_SubAdmin::getSubAdminsGroups($i))); + 'subadmin'=>implode(', ', OC_SubAdmin::getSubAdminsGroups($iuid))); } foreach( $accessiblegroups as $i ) { |