fix: persist access_grants.allow_groups in default permissions (#27124)

AccessGrantsPermissions only declared allow_users, so allow_groups was
missing from the model backing the default user permissions endpoints.
Pydantic ignores undeclared fields, so POST /users/default/permissions
dropped allow_groups before model_dump(), it never reached the persisted
user.permissions config, and fill_missing_permissions restored it to the
default on the next read. Turning "Allow Sharing With Groups" off in
Admin Settings silently reverted to on, while the same toggle worked when
set per group, since group permissions are stored as a plain dict.

GET /users/default/permissions and /users/default/permissions/defaults
dropped it from their responses for the same reason.

Declare allow_groups on the model so it round-trips, matching the
access_grants block in DEFAULT_USER_PERMISSIONS. It defaults to True, so
existing payloads that omit it are unaffected.
This commit is contained in:
Classic298
2026-07-24 05:53:59 +02:00
committed by GitHub
parent 92b4361e7b
commit ec18ce2ca0
+1
View File
@@ -207,6 +207,7 @@ class SharingPermissions(BaseModel):
class AccessGrantsPermissions(BaseModel):
allow_users: bool = True
allow_groups: bool = True
class ChatPermissions(BaseModel):