diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-16 12:32:56 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-24 17:52:15 +0200 |
commit | 10c135ca3414544a92febbc45b39d358c8383757 (patch) | |
tree | 17137dc89af559ed083dd36824ba78803a8e58d1 /lib/private/Group/Group.php | |
parent | 6689a3e37b5bc71a66462c547072ad7555958c05 (diff) | |
download | nextcloud-server-10c135ca3414544a92febbc45b39d358c8383757.tar.gz nextcloud-server-10c135ca3414544a92febbc45b39d358c8383757.zip |
Added disabled count per groups
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib/private/Group/Group.php')
-rw-r--r-- | lib/private/Group/Group.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 6795f0e2f53..cc6315263d4 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -10,6 +10,7 @@ * @author Robin McCorkell <robin@mccorkell.me.uk> * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Vincent Petry <pvince81@owncloud.com> + * @author John Molakvoæ <skjnldsv@protonmail.com> * * @license AGPL-3.0 * @@ -31,6 +32,7 @@ namespace OC\Group; use OCP\IGroup; use OCP\IUser; +use OCP\Group\Backend\ICountDisabledInGroup; class Group implements IGroup { /** @var null|string */ @@ -237,6 +239,26 @@ class Group implements IGroup { } /** + * returns the number of disabled users + * + * @return int|bool + */ + public function countDisabled() { + $users = false; + foreach ($this->backends as $backend) { + if($backend instanceOf ICountDisabledInGroup) { + if($users === false) { + //we could directly add to a bool variable, but this would + //be ugly + $users = 0; + } + $users += $backend->countDisabledInGroup($this->gid); + } + } + return $users; + } + + /** * search for users in the group by displayname * * @param string $search |