K-1 the plugin counts roles only from an array (getRoles). A single-valued roles field — a select, text or
relationship without hasMany, a radio — never makes a plugin admin, yet canHoldStaffRole said true: on a
project's own login collection with a single role select nobody could create, change, delete or unlock accounts,
the account holding admin included. rolesAreAList(collection) is now a precondition of the admin rules. The same
for hasPluginRoles: a single select whose values are all the plugin's had the admin rules already in 1.16.7 and
gets 'an account of this collection' now — its accounts manage each other again; the value still grants nothing.
A relationship with hasMany counts (ids that are text).
K-2 staffCollectionsNobodyManages returns { stuck, unchecked } and checks collection by collection: no query where
the field cannot hold admin; a count for a select with hasMany; for text / json / relationship the accounts are
read and the plugin's own test is applied. Where it cannot check it says so and claims nothing.
Tests: the reviewer's shapes over HTTP and the warning's table against a running Payload, 2FA off and on.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
10 lines
357 B
TypeScript
10 lines
357 B
TypeScript
/** A login collection with a single-valued role select, 2FA ON — see accountRulesSingleLoginSuite.ts. */
|
|
import { vi } from 'vitest'
|
|
|
|
import { singleLoginSuite } from './accountRulesSingleLoginSuite.js'
|
|
|
|
vi.mock('server-only', () => ({}))
|
|
vi.mock('next/headers.js', async () => (await import('./http/server.js')).nextHeadersMock)
|
|
|
|
singleLoginSuite(true)
|