get all display names from users in a given group
This commit is contained in:
parent
9bb8e05839
commit
4271430e60
6 changed files with 54 additions and 7 deletions
|
@ -286,4 +286,33 @@ class OC_Group {
|
|||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get a list of all display names in a group
|
||||
* @returns array with display names (key) and user ids(value)
|
||||
*/
|
||||
public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
|
||||
$displayNames=array();
|
||||
foreach(self::$_usedBackends as $backend) {
|
||||
$displayNames = array_merge($backend->displayNamesInGroup($gid, $search, $limit, $offset), $displayNames);
|
||||
}
|
||||
return $displayNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get a list of all display names in several groups
|
||||
* @param array $gids
|
||||
* @param string $search
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @return array with display names (Key) user ids (value)
|
||||
*/
|
||||
public static function displayNamesInGroups($gids, $search = '', $limit = -1, $offset = 0) {
|
||||
$displayNames = array();
|
||||
foreach ($gids as $gid) {
|
||||
// TODO Need to apply limits to groups as total
|
||||
$displayNames = array_merge(array_diff(self::displayNamesInGroup($gid, $search, $limit, $offset), $displayNames), $displayNames);
|
||||
}
|
||||
return $displayNames;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,5 +133,23 @@ abstract class OC_Group_Backend implements OC_Group_Interface {
|
|||
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get a list of all display names in a group
|
||||
* @param string $gid
|
||||
* @param string $search
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @return array with display names (key) and user ids (value)
|
||||
*/
|
||||
public function DisplayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) {
|
||||
$displayNames = '';
|
||||
$users = $this->usersInGroup($gid, $search, $limit, $offset);
|
||||
foreach ( $users as $user ) {
|
||||
$DisplayNames[$user] = $user;
|
||||
}
|
||||
|
||||
return $DisplayNames;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -62,9 +62,9 @@ class User {
|
|||
|
||||
/**
|
||||
* @brief Get a list of all display names
|
||||
* @returns array with all display names and the correspondig uids
|
||||
* @returns array with all display names (key) and the correspondig uids (value)
|
||||
*
|
||||
* Get a list of all display names.
|
||||
* Get a list of all display names and user ids.
|
||||
*/
|
||||
public static function getDisplayNames($search = '', $limit = null, $offset = null) {
|
||||
return \OC_USER::getDisplayNames($search, $limit, $offset);
|
||||
|
|
|
@ -460,9 +460,9 @@ class OC_User {
|
|||
|
||||
/**
|
||||
* @brief Get a list of all users display name
|
||||
* @returns associative array with all display names and corresponding uids
|
||||
* @returns associative array with all display names (key) and corresponding uids (value)
|
||||
*
|
||||
* Get a list of all users.
|
||||
* Get a list of all display names and user ids.
|
||||
*/
|
||||
public static function getDisplayNames($search = '', $limit = null, $offset = null) {
|
||||
$displayNames = array();
|
||||
|
|
|
@ -134,9 +134,9 @@ abstract class OC_User_Backend implements OC_User_Interface {
|
|||
|
||||
/**
|
||||
* @brief Get a list of all display names
|
||||
* @returns array with all displayNames and the correspondig uids
|
||||
* @returns array with all displayNames (key) and the correspondig uids (value)
|
||||
*
|
||||
* Get a list of all display names.
|
||||
* Get a list of all display names and user ids.
|
||||
*/
|
||||
public function getDisplayNames($search = '', $limit = null, $offset = null) {
|
||||
$displayNames = array();
|
||||
|
|
|
@ -26,7 +26,7 @@ if($isadmin) {
|
|||
$subadmins = OC_SubAdmin::getAllSubAdmins();
|
||||
}else{
|
||||
$accessiblegroups = OC_SubAdmin::getSubAdminsGroups(OC_User::getUser());
|
||||
$accessibleusers = OC_Group::usersInGroups($accessiblegroups, '', 30);
|
||||
$accessibleusers = OC_Group::displayNamesInGroups($accessiblegroups, '', 30);
|
||||
$subadmins = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue