Files
ipal-kit/test/accountRulesNobodyManages.test.ts
T
Radosław SmolińskiandClaude Fable 5.2 c3d95988e1 K-1, K-2: only a roles field that holds a LIST counts; the start-up check asks each collection its own way
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]>
2026-11-25 03:44:25 +01:00

10 lines
373 B
TypeScript

/** The start-up check for staff collections without an admin, 2FA off — see accountRulesNobodyManagesSuite.ts. */
import { vi } from 'vitest'
import { nobodyManagesSuite } from './accountRulesNobodyManagesSuite.js'
vi.mock('server-only', () => ({}))
vi.mock('next/headers.js', async () => (await import('./http/server.js')).nextHeadersMock)
nobodyManagesSuite(false)