martin
(Martin Brennan)
Juillet 16, 2026, 3:48
19
martin:
Par exemple, celui-ci provenant des menus latéraux des groupes, je pense que je le ferais fonctionner de la même manière, donc vous auriez ceci dans la configuration :
groups:
type: groups
required: true
resolve_group_memberships: true
validations:
max: 20
Ensuite, côté client, groups deviendrait user_in_groups en tant que booléen.
J’ai implémenté cela dans la PR ci-dessous :
main ← dev/resolve-group-membership-theme-object-group
merged 12:19AM - 17 Jul 26 UTC
Followup 7e77ce4bd3889820d67b52a5788357ac6f7b2f58
We need to automatically re… solve 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
Et @Lilly , j’ai créé une PR pour ton composant de thème group-sidebar-menus à partir d’un fork, qui applique cette fonctionnalité de manière rétrocompatible :
main ← martin-brennan:dev/apply-resolve-group-changes
opened 03:43AM - 16 Jul 26 UTC
See https://github.com/discourse/discourse/pull/41756, which must
be merged fir… st
`resolve_group_membership` can now be used on group type of theme setting object settings, so instead of relying on currentUser.groups which only has visible groups in the client, we can use `user_in_groups` which is automatically resolved from the server side
This is backwards-compatible with sites that don't yet have the
core functionality deployed
Je vais travailler sur la partie disallowed_groups ensuite.
2 « J'aime »