Skip to content

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

Merged
kptdobe merged 1 commit into
mainfrom
savelock
Jul 22, 2026
Merged

fix: disable save button when the user has no write permission#1162
kptdobe merged 1 commit into
mainfrom
savelock

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

(Supersedes #1161, closed when its branch got renamed out from under it.)

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 merged commit cfa8b00 into main Jul 22, 2026
5 of 11 checks passed
@kptdobe
kptdobe deleted the savelock branch July 22, 2026 10:06
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.

2 participants