Repository navigation
feat(slugField): prevent non-admins from changing slugs after creation - #364
Merged
Merged
Conversation
… update Non-admin managers can no longer change a slug after it is set. The generateSlug checkbox is hidden from non-admin UIs and its update access is blocked at the API layer. The slug text field update is likewise restricted. create access is left open so editors with collection-level create permission can still populate the slug on first save. Simplifies UserChoices.ts: the explicit inner-field locking is now redundant with the new slugField default. Closes #360 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Adds two integration tests to the Slug field access describe block: - meditations-editor cannot change the slug of a user-choice - admin manager can change the slug Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…kedSlugField Adds a custom LockedSlugField client component registered as admin.components.Field on the slug text field. Admins get the full SlugField UI (unlock/generate buttons); non-admins see only a read-only label + input with no interactive controls. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Standalone component with no sub-components — matches the flat-file convention used by AppCardViewSchedule.tsx, TimestampInput.tsx, etc. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #360
Problem
The slug field is a stable app-readable identifier the mobile client relies on (e.g.
quick-meditation--10-min). Non-admin editors could:Solution — two layers
LockedSlugFieldcomponent)access.update: adminOnlyFieldAccess)createstays openNon-admins can still set the slug when creating a new document (first save). Only
updateis restricted.Changes
src/components/admin/LockedSlugField/index.tsx— new'use client'component; renders fullSlugFieldfor admins, plain read-onlyTextInputfor everyone elsesrc/fields/slugField.ts— registersLockedSlugFieldasadmin.components.Fieldand passesuseAsSlugviaadmin.custom; locks checkbox (generateSlug) to admin-only on updatesrc/collections/tags/UserChoices.ts— simplified overrides (redundant per-field lock removed)tests/int/role-based-access.int.spec.ts— two new cases verifying API-layer slug protectionAffected collections (automatic via
slugFieldfactory)Pages, Authors, Meditations, SongTags, UserChoices
Test Results
🤖 Generated with Claude Code