Skip to content

New: Extend _access with a users grant key (fixes #46)#48

Merged
taylortom merged 1 commit into
masterfrom
new/access-users-key
Jul 9, 2026
Merged

New: Extend _access with a users grant key (fixes #46)#48
taylortom merged 1 commit into
masterfrom
new/access-users-key

Conversation

@taylortom

Copy link
Copy Markdown
Contributor

Fixes #46

New

  • Add a users grant key to the generic _access object via a $merge schema fragment (schema/users.schema.json), letting resources be shared with specific users. Annotated _adapt.inputType: "Principal" so the authoring UI can render it with no UI change.
  • Add UsersModule.registerUserModule(mod) — the consumer-facing opt-in that extends a module's schema with the users key and taps its accessCheckHook / accessQueryHook (called alongside enableAccessControl()). Grants are additive-OR with the base public grant; the query-level grant uses addAccessClause and is a no-op for unauthenticated requests.
  • Add and export a hasUserAccess utility for the per-item check.

Testing

  • New tests/utils-hasUserAccess.spec.js (table-driven) plus registerUserModule / checkUserAccess / grantUserAccess specs — 25 unit tests pass.
  • npx standard clean.
  • Verified schema composition against adapt-schemas: extending a schema with access then users resolves _access with both public and users; a document setting both validates and round-trips.

@taylortom
taylortom merged commit 5210d4c into master Jul 9, 2026
3 checks passed
@taylortom
taylortom deleted the new/access-users-key branch July 9, 2026 16:47
github-actions Bot pushed a commit that referenced this pull request Jul 9, 2026
# [1.4.0](v1.3.4...v1.4.0) (2026-07-09)

### Chore

* replace legacy new.yml with direct add-to-project workflow ([7356807](7356807))
* trigger add-to-project on reopened issues and PRs ([195dab6](195dab6))

### Docs

* Add README ([cdbb27c](cdbb27c))

### New

* Extend _access with a users grant key (fixes #46) (#48) ([5210d4c](5210d4c)), closes [#46](#46) [#48](#48)

### Upgrade

* Bump adapt-authoring-api from 3.10.0 to 4.0.1 ([79586e8](79586e8))
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 1.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Development

Successfully merging this pull request may close these issues.

New: Extend _access with users key

1 participant