Skip to content

Commit

Permalink
Merge pull request #590 from nextcloud/backport/581/stable19
Browse files Browse the repository at this point in the history
[stable19] forceAll in linkedGroups
  • Loading branch information
ArtificialOwl authored May 5, 2021
2 parents bc2442f + 78240f4 commit 0a1d3ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/Db/MembersRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ public function createMember(Member $member) {
*
* @return Member[]
*/
public function getGroupsFromCircle($circleUniqueId, Member $viewer) {
if ($viewer->getLevel() < Member::LEVEL_MEMBER) {
public function getGroupsFromCircle($circleUniqueId, ?Member $viewer, bool $forceAll = false) {
if (!$forceAll && $viewer->getLevel() < Member::LEVEL_MEMBER) {
return [];
}

Expand All @@ -527,7 +527,7 @@ public function getGroupsFromCircle($circleUniqueId, Member $viewer) {
$cursor = $qb->execute();
$groups = [];
while ($data = $cursor->fetch()) {
if ($viewer->getLevel() < Member::LEVEL_MODERATOR) {
if (!$forceAll && $viewer->getLevel() < Member::LEVEL_MODERATOR) {
$data['note'] = '';
}
$groups[] = $this->parseGroupsSelectSql($data);
Expand Down
6 changes: 3 additions & 3 deletions lib/Service/CirclesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public function detailsCircle($circleUniqueId, $forceAll = false) {
->isLevel(Member::LEVEL_MEMBER)
) {
$this->detailsCircleMembers($circle, $forceAll);
$this->detailsCircleLinkedGroups($circle);
$this->detailsCircleLinkedGroups($circle, $forceAll);
$this->detailsCircleFederatedCircles($circle);
}
} catch (Exception $e) {
Expand Down Expand Up @@ -324,12 +324,12 @@ private function detailsCircleMembers(Circle $circle, $forceAll = false) {
*
* @throws GSStatusException
*/
private function detailsCircleLinkedGroups(Circle $circle) {
private function detailsCircleLinkedGroups(Circle $circle, bool $forceAll = false) {
$groups = [];
if ($this->configService->isLinkedGroupsAllowed()) {
$groups =
$this->membersRequest->getGroupsFromCircle(
$circle->getUniqueId(), $circle->getHigherViewer()
$circle->getUniqueId(), $circle->getHigherViewer(), $forceAll
);
}

Expand Down

0 comments on commit 0a1d3ec

Please sign in to comment.