Skip to content

fix: disable save button when the user has no write permission#1161

Closed
kptdobe wants to merge 1 commit into
mainfrom
fix/disable-save-when-config-read-only
Closed

fix: disable save button when the user has no write permission#1161
kptdobe wants to merge 1 commit into
mainfrom
fix/disable-save-when-config-read-only

Conversation

@kptdobe

@kptdobe kptdobe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The lock icon (is-read-only class, driven by _readOnly in da-title.js) already reflected read-only state correctly, but the Save action button's disabled binding only checked this.disabledText - it ignored _readOnly entirely.
  • A user viewing a config/sheet in read-only mode could still click Save, only discovering the failure after the round-trip to the admin API.
  • renderActions() now disables the save action (with a tooltip) when _readOnly is true. handleAction('save') also bails early as a guard against a stale/bypassed disabled state.

Test plan

  • npx eslint blocks/edit/da-title/da-title.js test/unit/blocks/edit/da-title/da-title.test.js
  • npx wtr "./test/unit/blocks/edit/da-title/da-title.test.js" --node-resolve — 50 passing
  • Added tests: save button disabled reflects permissions in renderActions, and handleAction('save') is a no-op (no fetch) when read-only

The lock icon already reflected read-only state via the is-read-only
class, but the Save action button ignored `_readOnly` entirely - only
`disabledText` gated it. A user with read-only config access could still
click Save (and would only find out it failed after the request).
Disable the save button (with a tooltip) when read-only, and guard
handleAction('save') itself in case the disabled state is bypassed.
@aem-code-sync

aem-code-sync Bot commented Jul 22, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@kptdobe

kptdobe commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Branch renamed to comply with this repo's CLAUDE.md branch-naming rule (max 8 lowercase alphanumeric chars) - GitHub closed this PR as a side effect. Continued as #1162.

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