diff options
Diffstat (limited to 'lib/private/Group')
-rw-r--r-- | lib/private/Group/Group.php | 27 | ||||
-rw-r--r-- | lib/private/Group/MetaData.php | 4 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/private/Group/Group.php b/lib/private/Group/Group.php index 275b697bc3b..0d54cf8e35a 100644 --- a/lib/private/Group/Group.php +++ b/lib/private/Group/Group.php @@ -30,6 +30,7 @@ namespace OC\Group; +use OCP\GroupInterface; use OCP\IGroup; use OCP\IUser; use OCP\Group\Backend\ICountDisabledInGroup; @@ -323,4 +324,30 @@ class Group implements IGroup { } return $users; } + + /** + * @return bool + * @since 14.0.0 + */ + public function canRemoveUser() { + foreach ($this->backends as $backend) { + if ($backend->implementsActions(GroupInterface::REMOVE_FROM_GOUP)) { + return true; + } + } + return false; + } + + /** + * @return bool + * @since 14.0.0 + */ + public function canAddUser() { + foreach ($this->backends as $backend) { + if ($backend->implementsActions(GroupInterface::ADD_TO_GROUP)) { + return true; + } + } + return false; + } } diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php index 497dcf72b59..f4877237ec7 100644 --- a/lib/private/Group/MetaData.php +++ b/lib/private/Group/MetaData.php @@ -165,7 +165,9 @@ class MetaData { 'id' => $group->getGID(), 'name' => $group->getDisplayName(), 'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0, - 'disabled' => $group->countDisabled() + 'disabled' => $group->countDisabled(), + 'canAdd' => $group->canAddUser(), + 'canRemove' => $group->canRemoveUser(), ); } |