fix(frontend): prevent editing description without write access#6834
Open
Raja-Hamid wants to merge 1 commit into
Open
fix(frontend): prevent editing description without write access#6834Raja-Hamid wants to merge 1 commit into
Raja-Hamid wants to merge 1 commit into
Conversation
The list row's editable input only means 'this is the private dashboard view' and is hardcoded to true by the container, so it was never an access check. A user with READ-only access to a shared workflow could therefore open the description editor; the save then failed with the backend's 'No sufficient access privilege.'. Gate description editing on the entry's actual access level: - add a canEditDescription getter (editable && entry.accessLevel === 'WRITE') - use it as the guard in onEditDescription() - hide the Edit Description control and the 'Write a description...' hover placeholder for read-only entries This mirrors the existing dataset list-item pattern (editable && entry.accessPrivilege === 'WRITE'). Closes apache#3497
Contributor
Automated Reviewer SuggestionsBased on the
|
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.
What changes were proposed in this PR?
On the workflow list, the description of a read-only workflow was still editable.
ListItemComponent'seditableinput only means "this is the private dashboard view" and is hardcoded[editable]="true"by the container (user-workflow.component.html:184,193), so it was never an access check —onEditDescription()guarded on it alone. A user with READ-only access to a shared workflow could open the editor, and only the backend rejected the save (WorkflowResource.scala:153-164,ForbiddenException("No sufficient access privilege.")).The access data was already on the bound entry and already used in the same file (e.g.
list-item.component.ts:219for the share modal) — it just wasn't consulted for editing.Fix (
list-item.component.ts/.html):canEditDescriptiongetter:editable && entry.accessLevel === "WRITE"onEditDescription()guards on it — both entry points funnel through it, so the modal and the failing request are unreachable without WRITEMirrors the existing dataset pattern (
user-dataset-list-item.component.html:49).Scope is deliberately limited to the description, per the issue. Rename (
onEditName()) and the card view share the same class of bug and are better handled separately, as is the duplicate error toast.Any related issues, documentation, discussions?
Closes #3497
How was this PR tested?
Unit tests (Vitest) — 4 new cases in
list-item.component.spec.ts(no-modal + control-hidden for READ, plus WRITE regression guards):corepack yarn ng test --watch=false --include="**/list-item.component.spec.ts"
→ 24/24 passing; 2 of the new cases were red before the fix.
Regression across components embedding
ListItemComponent:corepack yarn ng test --watch=false
--include="/list-item.component.spec.ts" --include="/card-item.component.spec.ts"
--include="/search-results.component.spec.ts" --include="/user-workflow.component.spec.ts"
--include="**/hub-search-result.component.spec.ts"
→ 5 files, 180/180 passing
Manual:
bin/single-nodestack +ng serve; seeded a workflow owned by another user and shared READ-only. In Your Work → Workflows the read-only row no longer exposes the Edit Description control or the hover placeholder and clicking does nothing, while WRITE rows still open the editor and save successfully.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Yes alongside Claude Code