Skip to content

[Grid] Respect user and workflow permissions for batch edit and batch delete - #3954

Open
xIrusux wants to merge 4 commits into
2026.xfrom
fix/3413-grid-user-workflow-permissions-2026.x
Open

[Grid] Respect user and workflow permissions for batch edit and batch delete#3954
xIrusux wants to merge 4 commits into
2026.xfrom
fix/3413-grid-user-workflow-permissions-2026.x

Conversation

@xIrusux

@xIrusux xIrusux commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Part of #3413

What

In the grid listing, the batch actions Batch edit and Delete were available regardless of permissions. They are now disabled unless every selected row grants the required permission (save for batch edit, delete for batch delete) and is not locked.

  • batch-actions.tsx: gate menu items via the existing checkElementPermission helper (all-or-nothing over the selection)
  • with-row-selection.tsx: capture each selected row's permissions and isLocked into selectedRowsData at selection time, so the check stays correct across pagination (row-level fields were previously discarded — only system-column values were kept)

The single-delete context menu item already checks permissions.delete and needs no change.

Workflow permissions

The row permissions payload is produced by the backend. A counterpart studio-backend-bundle PR merges workflow place permissions (via Workflow\Manager::isDeniedInWorkflow()) into that payload, so these gates automatically respect workflow state as well — no separate frontend logic needed. Fully resolving #3413 requires both PRs.

Testing

Verified manually on the demo (Cars in a workflow place denying modify/delete, plus a non-admin user with a restricted workspace): single delete hidden, batch edit/delete disabled for restricted rows and mixed selections; unrestricted control object keeps all actions.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 30, 2026 17:00
@xIrusux xIrusux self-assigned this Jul 30, 2026
@xIrusux xIrusux added this to the 2026.3.0 milestone Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Verdict: Needs changes. The PR captures row permissions and lock state across pagination, then gates data-object batch edit/delete actions.

Changes:

  • Persists permissions and isLocked for selected rows.
  • Requires all selected rows to permit save/delete.
  • Disables actions for locked rows.

Review assessment:

  • Root cause: Mostly addressed at with-row-selection.tsx:86-90 and batch-actions.tsx:45-51.
  • Blocking issue: selectedRowsData retains deselected rows, so stale entries incorrectly affect permissions (batch-actions.tsx:45-48).
  • Call sites/boundary: Object batch edit/delete are covered at the appropriate consumer.
  • Compatibility: No public API break.
  • Tests: Only manual verification is documented; the stale-selection edge case remains untested.
  • Docs/changelog: No update appears necessary for this bug fix.
  • Risk: Backend authorization from the counterpart PR remains unverified here.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
with-row-selection.tsx Stores permission and lock metadata for selected rows.
batch-actions.tsx Gates object batch edit and delete actions.

Comment thread assets/js/src/core/modules/data-object/listing/batch-actions/batch-actions.tsx Outdated
xIrusux and others added 3 commits July 30, 2026 19:15
selectedRowsData is an accumulating cache that retains deselected rows;
iterate the current selection keys instead so stale entries are ignored
and rows with missing metadata fail closed.

Co-Authored-By: Claude <noreply@anthropic.com>
selectedRowsData is an accumulating cache that retains deselected rows,
so iterating its values let stale entries block batch edit/delete after
deselection, while an empty cache briefly allowed actions on freshly
selected rows before their metadata was captured. Iterate the current
selectedRows ids instead, so stale entries are ignored and rows with
missing metadata fail closed. Type the row access to satisfy the
no-unsafe-argument lint rule.

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@xIrusux xIrusux linked an issue Aug 3, 2026 that may be closed by this pull request
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.

[Grid view] - respect user and workflow permissions in the grid

2 participants