Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/user_saml.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2019-11-28 17:20:03 +0300
committerArthur Schiwon <blizzz@arthur-schiwon.de>2020-01-29 16:37:49 +0300
commit1c1fdad5ec56ab0c4d5999663c84c7a4b244a154 (patch)
treed9a2fbe88a2f58a6e1e31a77e0c0b5eb0bee044b
parent1611b2988aad373c3ae7feea45a78feea769ebad (diff)
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>
-rw-r--r--lib/UserBackend.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/UserBackend.php b/lib/UserBackend.php
index d421002a..bf1539a2 100644
--- a/lib/UserBackend.php
+++ b/lib/UserBackend.php
@@ -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);
}
@@ -691,4 +692,13 @@ class UserBackend implements IApacheBackend, UserInterface, IUserBackend {
}
}
}
+
+ public function countUsers() {
+ $query = $this->db->getQueryBuilder();
+ $query->select($query->func()->count('uid'))
+ ->from('user_saml_users');
+ $result = $query->execute();
+
+ return $result->fetchColumn();
+ }
}