Add countUsersInGroup
This commit is contained in:
@@ -75,5 +75,20 @@ class OC_GROUP_SQL extends \OC_Group_Backend implements \OCP\GroupInterface
|
||||
}
|
||||
return $users;
|
||||
}
|
||||
|
||||
public function countUsersInGroup($gid, $search = '') {
|
||||
if(empty($this -> settings['sql_group_table']))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
$search = "%".$search."%";
|
||||
$count = $this -> helper -> runQuery('countUsersInGroup', array('gid' => $gid, 'search' => $search));
|
||||
if($count === false)
|
||||
{
|
||||
return 0;
|
||||
} else {
|
||||
return intval(reset($count));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -188,6 +188,10 @@ class Helper {
|
||||
case 'getGroupUsers':
|
||||
$query = "SELECT distinct ".$this->settings['col_group_username']." FROM ".$this->settings['sql_group_table']." WHERE ".$this->settings['col_group_name']." = :gid";
|
||||
break;
|
||||
|
||||
case 'countUsersInGroup':
|
||||
$query = "SELECT count(".$this->settings['col_group_username'].") FROM ".$this->settings['sql_group_table']." WHERE ".$this->settings['col_group_name']." = :gid AND ".$this->settings['col_group_username']." LIKE :search";
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($limits['limit']) && $limits['limit'] !== null)
|
||||
|
||||
Reference in New Issue
Block a user