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:
co-authored by
Claude Fable 5.2
parent
01219b69d3
commit
be2e6d52d9
@@ -19,7 +19,7 @@ import { Pages } from './collections/Pages'
|
||||
import { Posts } from './collections/Posts'
|
||||
// @starter:endif
|
||||
// @starter:if demo
|
||||
import { E2E_LATE_STAFF, e2eLateStaff } from '../e2e/late-staff-fixture'
|
||||
import { E2E_LATE_STAFF, E2E_STAFF_SLUGS, e2eEarlyStaff, e2eLateStaff } from '../e2e/late-staff-fixture'
|
||||
// @starter:endif
|
||||
import { contentConfig } from './content.config'
|
||||
import { db } from './db'
|
||||
@@ -56,11 +56,14 @@ export default buildConfig({
|
||||
sharp,
|
||||
typescript: { outputFile: path.resolve(dirname, 'payload-types.ts') },
|
||||
plugins: [
|
||||
// @starter:if demo
|
||||
e2eEarlyStaff, // a test fixture, a no-op without E2E_LATE_STAFF=1 (e2e/late-staff-fixture.ts)
|
||||
// @starter:endif
|
||||
ipalKit({
|
||||
i18n: i18nConfig,
|
||||
// @starter:if demo
|
||||
// (the staffCollections entry exists only for e2e/late-staff.spec.ts, with E2E_LATE_STAFF=1)
|
||||
access: { authCollection: 'users', ...(E2E_LATE_STAFF ? { staffCollections: ['late-staff'] } : {}) },
|
||||
access: { authCollection: 'users', ...(E2E_LATE_STAFF ? { staffCollections: E2E_STAFF_SLUGS } : {}) },
|
||||
// @starter:else
|
||||
//: access: { authCollection: 'users' },
|
||||
// @starter:endif
|
||||
|
||||
Reference in New Issue
Block a user