A staff collection whose accounts can hold editor or admin gets the admin rules (H-2, J-3)

In the released 1.16.7. The plugin's checks go by the value on the account, but a project's own staff collection
without rules got the admin rules only when ALL its role values were the plugin's; otherwise 'an account of this
collection' could create, change and delete accounts. Measured on bc0fa65 (SQLite; the first shape also on Postgres
and MongoDB, 2FA off and on): with roles user/editor/admin/boss, with a text and with a json roles field, config-time
and added by a later plugin, an account with the role user creates an admin (201) who reads Site integrations, changes
another staff collection's roles and lists the panel's accounts (200 / 200 / 200), takes the admin over and deletes it;
with viewer/editor a viewer creates an editor who gets past the access rule of Site settings.
canHoldStaffRole(collection): a roles select with editor or admin among its values, or a roles field whose values
cannot be listed. Then: create / delete / unlock an admin, update an admin or the account itself, roles only by an
admin. A project's own rules win. A warning at start when no staff account is an admin and such a collection exists.
The built-site fixture gets a config-time and a late collection of that kind; nothing here touches copied collections.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-25 02:59:44 +01:00
co-authored by Claude Fable 5.2
parent 01219b69d3
commit be2e6d52d9
10 changed files with 318 additions and 10 deletions
+2
View File
@@ -30,11 +30,13 @@ export {
applyStaffAccountAccess,
bothAllow,
buildFirstUserEndpoint,
canHoldStaffRole,
hasPluginRoles,
openSignUpCollections,
rolesByAdminOnly,
rolesNotOwn,
sameStaffCollectionAccess,
staffCollectionsNobodyManages,
staffCollectionsOnOwnRoles,
staffCollectionsOpenToOthers,
staffCreateAccess,