Skip to content

Commit 0cb0b22

Browse files
committed
fix(kanban): disable task edit for non-assignees and enforce guard in edit action
1 parent ead372f commit 0cb0b22

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/app/features/projects/components/project-kanban/project-kanban.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ <h2>Project Kanban Board</h2>
148148
<span class="task-card__title">{{ task.title }}</span>
149149
<div class="task-card__header-actions">
150150
<p-tag *ngIf="isTaskPending(task.id)" severity="info" value="Saving"></p-tag>
151-
<button pButton type="button" icon="pi pi-pencil" class="p-button-rounded p-button-text p-button-sm" [disabled]="isTaskPending(task.id)" (click)="openEditTask(task)"></button>
151+
<button pButton type="button" icon="pi pi-pencil" class="p-button-rounded p-button-text p-button-sm" [disabled]="isTaskPending(task.id) || !canEditTask(task)" (click)="openEditTask(task)"></button>
152152
<button
153153
pButton
154154
type="button"

src/app/features/projects/components/project-kanban/project-kanban.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ export class ProjectKanbanComponent implements OnInit, OnDestroy {
213213
}
214214

215215
openEditTask(task: TaskItemDto): void {
216+
if (!this.canEditTask(task) || this.isTaskPending(task.id)) {
217+
return;
218+
}
219+
216220
this.editTaskId = task.id;
217221
this.taskForm = {
218222
title: task.title,
@@ -348,6 +352,10 @@ export class ProjectKanbanComponent implements OnInit, OnDestroy {
348352
return !!this.currentUserId && task.assignedUserId === this.currentUserId;
349353
}
350354

355+
canEditTask(task: TaskItemDto): boolean {
356+
return this.canManageAllTasks || this.isAssignedToMe(task);
357+
}
358+
351359
canDeleteTask(task: TaskItemDto): boolean {
352360
return this.canManageAllTasks || this.isAssignedToMe(task);
353361
}

0 commit comments

Comments
 (0)