0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 05:42:36 +08:00
discourse/docs
Martin Brennan bee1be8599
DEV: Add resolve_group_membership for theme object settings of group type (#41756)
Followup 7e77ce4bd3

We need to automatically resolve group membership into a boolean
for theme object type settings which are of the group type, similar
to what we did in the original commit above for group list type
settings.

This behaves in the same way -- for an object setting schema like this:

```
menu_sections:
  type: objects
  default:
    - name: section 1
      groups:
        - 1
        - 3
  schema:
    name: menu section
    properties:
      name:
        type: string
      groups:
        type: groups
        resolve_group_membership: true
```

We replace `groups` with a boolean `user_in_groups` (groups is just
the property name, it could be foo_bar etc.) and then you can
do this on the client:

```
for (const section of settings.menu_sections) {
  if (section.user_in_groups) {
    // User is in at least one selected group for this section.
  }
}
```

Rather than inspecting the `currentUser.groups`, which only includes
visible groups, not all groups the user is a member of. This allows
for more accurate permission checks for theme settings that are group
based.

Also c.f.
https://meta.discourse.org/t/granular-group-based-permissions-for-anonymous-and-logged-in-users/402273/18?u=martin
2026-07-17 10:19:29 +10:00
..
developer-guides DEV: Add resolve_group_membership for theme object settings of group type (#41756) 2026-07-17 10:19:29 +10:00
ADMIN-QUICK-START-GUIDE.md fix emojis (#34411) 2025-08-19 11:25:20 +02:00
AUTHORS.md HTTPSify links (#7046) 2019-02-22 16:29:27 +01:00
code-of-conduct.md
INSTALL-cloud.md DOCS: Mention updated plan names in INSTALL-cloud.md (#41618) 2026-07-14 16:48:46 +05:30
INSTALL-email.md DOCS: Update Brevo's SMTP config (#38770) 2026-03-24 09:09:07 +01:00
INSTALL.md DOCS: amend documented required PostgreSQL version (#37931) 2026-02-24 17:20:04 +11:00
PLUGINS.md UX: update category references in documentation to match meta changes (#41263) 2026-06-29 11:33:49 -04:00
SECURITY.md FEATURE: Increase pbkdf2 iterations to 600k (#20981) 2023-04-11 11:56:20 +01:00
TESTING.md