# Groups with visibility\_level 'owner' are not visible for staff

**URL:** <https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963>\
**Category:** Bug\
**Created:** [July 15, 2019, 11:31am UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963 "2019-07-15T11:31:15Z")\
**Posts on this page:** 8\
**Page:** 1

## AI-generated summary

Groups with a visibility level set to `owner` are not visible to staff, even though they should be. [RGJ](/t/-/122963/1) discovered this issue and questioned its intentionality, providing code snippets from Discourse's source code. [eviltrout](/t/-/122963/3) confirmed that the code is 2 years old and seems intentional, but [outofthebox](/t/-/122963/4) reported a reversion of this behavior, having previously been able to view all groups as an admin.

[Justin](/t/-/122963/5) also experienced this issue and reported it separately, noting that it seems like a regression since version 2.4.beta2. He pointed out that it's possible this issue is related to the Babble plugin, which modifies the Group model. [RGJ](/t/-/122963/7) confirmed that both affected forums have the Babble plugin installed, suggesting a potential link.

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [July 15, 2019, 11:31am UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/1 "2019-07-15T11:31:16Z")

</div>

It seems that groups with visibility level `owner` are not visible for staff.

Visibility level `staff` does provide a mechanism to ensure visibility (using the `left join` instead of `join` and the extra `where` clause) but visibility level `owner` does not.

> **[Blaming discourse/app/models/group.rb at stable · discourse/discourse](https://github.com/discourse/discourse/blame/stable/app/models/group.rb#L122-L134)**
>
> A platform for community discussion. Free, open, simple. - Blaming discourse/app/models/group.rb at stable · discourse/discourse

(hmm oneboxing Github source does not work anymore?)

```
  SELECT g.id FROM groups g
  LEFT JOIN group_users gu ON gu.group_id = g.id AND
                         gu.user_id = :user_id AND
                         gu.owner
  WHERE g.visibility_level = :staff AND (gu.id IS NOT NULL OR :is_staff)
  UNION ALL
  SELECT g.id FROM groups g
  JOIN group_users gu ON gu.group_id = g.id AND
                         gu.user_id = :user_id AND
                         gu.owner
  WHERE g.visibility_level = :owners

```

Is this intentional?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [July 16, 2019, 12:00am UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/2 "2019-07-16T00:00:18Z")

</div>

Didn’t we work on this recently @eviltrout?

---

<div class="post-metadata">

**Author:** ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)\
**Post date:** [July 16, 2019, 6:40pm UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/3 "2019-07-16T18:40:13Z")

</div>

This code is 2 years old so it was not changed recently.

It does seem intentional because even the case of restricting a group to its members does not make an exception for staff:

> <https://github.com/discourse/discourse/blob/stable/app/models/group.rb#L115-L118>

(BTW github oneboxes fine, but the blame URL is not handled.)

---

<div class="post-metadata">

**Author:** ![outofthebox](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/outofthebox/32/83708_2.png) [@outofthebox](https://meta.discourse.org/u/outofthebox)\
**Post date:** [August 6, 2019, 5:22pm UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/4 "2019-08-06T17:22:48Z")

</div>

Hi,

It seems there has been a reversion here? Since starting with Discourse, as admin, I’ve had access to all groups. In the past couple of weeks, I have been unable to view many of them.

This is difficult because the group owners will ask me to do bulk invites through the admin interface to invite new groups of members to their group (and the associated private Categories).

In light of this, I would strongly advocate for all groups being visible to admins.

---

<div class="post-metadata">

**Author:** ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)\
**Post date:** [August 6, 2019, 5:43pm UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/5 "2019-08-06T17:43:34Z")

</div>

I also reported this here: [Babble: Admins can't see a group set to `group owner` only visibility](https://meta.discourse.org/t/admins-cant-see-a-group-set-to-group-owner-only-visibility/123413)

This does seem like a regression to me as prior to 2.4.beta2 I was able to see all groups as an admin.

---

<div class="post-metadata">

**Author:** ![justin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/justin/32/157614_2.png) [@justin](https://meta.discourse.org/u/justin)\
**Post date:** [August 8, 2019, 8:46pm UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/6 "2019-08-08T20:46:39Z")

</div>

@RGJ please see the post on this topic: [Babble: Admins can't see a group set to `group owner` only visibility - #13 by justin](https://meta.discourse.org/t/admins-cant-see-a-group-set-to-group-owner-only-visibility/123413/13)

It’s possible this is related to Babble or any other plugin which modifies the Group model.

---

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [August 8, 2019, 10:02pm UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/7 "2019-08-08T22:02:09Z")

</div>

Yes, that makes sense, both forums where we saw this have the Babble plugin installed. Nice find!

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [January 10, 2020, 6:23am UTC](https://meta.discourse.org/t/groups-with-visibility-level-owner-are-not-visible-for-staff/122963/8 "2020-01-10T06:23:04Z")

</div>

Closed on January 10, 2020, 6:23am UTC


