Skip to content

Feature/admin forth/1942/centralize shared checks in ad - #719

Open
NoOne7135 wants to merge 10 commits into
mainfrom
feature/AdminForth/1942/centralize-shared-checks-in-ad
Open

NoOne7135 wants to merge 10 commits into
mainfrom
feature/AdminForth/1942/centralize-shared-checks-in-ad

Conversation

@NoOne7135

Copy link
Copy Markdown
Collaborator

No description provided.

Column-level access rules (backendOnly, editReadonly, showIn,
allowModifyWhenNotShowIn*) lived as private helpers inside restApi.ts, so every
plugin re-implemented them by hand and each copy dropped a different check.

Add adminforth.resource(id).asUser(adminUser, { meta }) and .asSystem({ hooks })
as the single entry point for resource access, backed by one pipeline:

- columnAccess.ts owns backendOnly/showIn resolution, record write policy, read
  stripping, and aggregation column exposure
- resourceAccess.ts owns interpretResource, breaking the restApi/connector
  import cycle
- create_record, update_record, delete_record and aggregate go through the
  scoped API, so the core path and the plugin path cannot drift apart
- createResourceRecord/updateResourceRecord/deleteResourceRecord and unscoped
  resource() calls remain as deprecated aliases with runtime warnings
- a denied or failed operation is always visible: reads and delete throw, create
  and update resolve to { ok, error }

Also fixes /aggregate, which resolved allowedActions with a single ListRequest
pass and then required allowedActions.show, which that source always sets to
false, so the endpoint rejected every request. list and show are now resolved
separately.
@Romsik788 Romsik788 mentioned this pull request Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant