mirror of
https://github.com/netzbegruenung/user_saml.git
synced 2024-05-06 02:53:40 +02:00
Add counting to the user backend
This will allow reporting to also list the number of SAML users on the instance. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
3ecdb61998
commit
8888d5a9ad
|
@ -183,6 +183,7 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
$availableActions = \OC\User\Backend::CHECK_PASSWORD;
|
||||
$availableActions |= \OC\User\Backend::GET_DISPLAYNAME;
|
||||
$availableActions |= \OC\User\Backend::GET_HOME;
|
||||
$availableActions |= \OC\User\Backend::COUNT_USERS;
|
||||
return (bool)($availableActions & $actions);
|
||||
}
|
||||
|
||||
|
@ -733,4 +734,13 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
|
|||
|
||||
return strtoupper($hex_guid_to_guid_str);
|
||||
}
|
||||
|
||||
public function countUsers() {
|
||||
$query = $this->db->getQueryBuilder();
|
||||
$query->select($query->func()->count('uid'))
|
||||
->from('user_saml_users');
|
||||
$result = $query->execute();
|
||||
|
||||
return $result->fetchColumn();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue