martin
(Martin Brennan)
16 يوليو 2026، 3:48ص
19
martin:
هذا على سبيل المثال من قوائم الشريط الجانبي للمجموعات، أعتقد أنني سأجعله يعمل بنفس الطريقة، لذا سيكون لديك هذا في التكوين:
groups:
type: groups
required: true
resolve_group_memberships: true
validations:
max: 20
ثم على العميل، سيصبح groups كـ user_in_groups كقيمة منطقية (boolean).
لقد قمت بتنفيذ ذلك في طلب السحب (PR) أدناه:
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
وأهلاً @Lilly ، لقد قمت بإنشاء طلب سحب لمكون موضوع قوائم الشريط الجانبي للمجموعات الخاص بك من شق (fork) يطبق هذه الوظيفة بطريقة متوافقة مع الإصدارات السابقة:
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
سأعمل على جزء disallowed_groups تالياً.
إعجابَين (2)