diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-04-26 12:37:48 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-29 00:59:09 -0300 |
commit | 668fe7df51e097a762d9f03e0329a06d0751cd78 (patch) | |
tree | 5d4cb3e398e6cfee2122af5838db617a6c7c62a2 /lib | |
parent | 8f5f26c88d53b13a9ea7e5d9fe531decf0356879 (diff) | |
download | nextcloud-server-668fe7df51e097a762d9f03e0329a06d0751cd78.tar.gz nextcloud-server-668fe7df51e097a762d9f03e0329a06d0751cd78.zip |
UserManager can now count disabled users
Users page takes advantage of that
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/User/Manager.php | 22 | ||||
-rw-r--r-- | lib/public/IUserManager.php | 8 |
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index 4a87dc7161c..0477f23e552 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -412,6 +412,28 @@ class Manager extends PublicEmitter implements IUserManager { * returns how many users have logged in once * * @return int + * @since 12.0.0 + */ + public function countDisabledUsers() { + $queryBuilder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); + $queryBuilder->select($queryBuilder->createFunction('COUNT(*)')) + ->from('preferences') + ->where($queryBuilder->expr()->eq('appid', $queryBuilder->createNamedParameter('core'))) + ->andWhere($queryBuilder->expr()->eq('configkey', $queryBuilder->createNamedParameter('enabled'))) + ->andWhere($queryBuilder->expr()->eq('configvalue', $queryBuilder->createNamedParameter('false'))); + + $query = $queryBuilder->execute(); + + $result = (int)$query->fetchColumn(); + $query->closeCursor(); + + return $result; + } + + /** + * returns how many users have logged in once + * + * @return int * @since 11.0.0 */ public function countSeenUsers() { diff --git a/lib/public/IUserManager.php b/lib/public/IUserManager.php index 1ec392dfd82..6c6724487de 100644 --- a/lib/public/IUserManager.php +++ b/lib/public/IUserManager.php @@ -160,6 +160,14 @@ interface IUserManager { * @return int * @since 11.0.0 */ + public function countDisabledUsers(); + + /** + * returns how many users have logged in once + * + * @return int + * @since 11.0.0 + */ public function countSeenUsers(); /** |