Skip to content

Commit e55563e

Browse files
committed
fix(tasks): hide and block "Assign to me" for project managers in All Tasks
1 parent 4397d71 commit e55563e

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/app/features/task-item/components/task-item-list/task-item-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ <h2>All Tasks</h2>
195195
</p-dropdown>
196196

197197
<button
198-
*ngIf="isUnassigned(task)"
198+
*ngIf="isUnassigned(task) && canSelfAssignTasks"
199199
pButton
200200
type="button"
201201
icon="pi pi-user-plus"

src/app/features/task-item/components/task-item-list/task-item-list.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { TaskItemsApiClient } from '../../../../core/api/clients/task-items-api.
88
import { ProjectDto } from '../../../../core/api/models/project.model';
99
import { TaskItemDto } from '../../../../core/api/models/task-item.model';
1010
import { TaskStatus } from '../../../../core/api/models/task-status.enum';
11-
import { MANAGEMENT_ROLES } from '../../../../core/auth/models/app-role.model';
11+
import { AppRole, MANAGEMENT_ROLES } from '../../../../core/auth/models/app-role.model';
1212
import { AuthService } from '../../../../core/auth/services/auth.service';
1313
import { APP_ENVIRONMENT } from '../../../../core/config/app-environment.token';
1414
import { AppPreferencesService } from '../../../../core/preferences/app-preferences.service';
@@ -124,6 +124,10 @@ export class TaskItemListComponent implements OnInit, OnDestroy {
124124
return this.authService.hasAnyRole([...MANAGEMENT_ROLES]);
125125
}
126126

127+
get canSelfAssignTasks(): boolean {
128+
return this.authService.hasRole(AppRole.User);
129+
}
130+
127131
get defaultTablePageSize(): number {
128132
return this.preferencesService.preferences().defaultTablePageSize;
129133
}
@@ -243,7 +247,7 @@ export class TaskItemListComponent implements OnInit, OnDestroy {
243247

244248
assignToMe(task: TaskItemDto): void {
245249
const userId = this.currentUserId;
246-
if (!userId || this.isTaskPending(task.id) || !this.isUnassigned(task)) {
250+
if (!this.canSelfAssignTasks || !userId || this.isTaskPending(task.id) || !this.isUnassigned(task)) {
247251
return;
248252
}
249253

0 commit comments

Comments
 (0)