Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(notifications): 622 - Admin / User should not be able to edit… #1159

Merged
merged 7 commits into from
Apr 11, 2024
4 changes: 2 additions & 2 deletions frontend/src/app/modules/core/user/role.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ export class RoleService {

}

public isAtLeastSupervisor(): boolean {
public isSupervisor(): boolean {
return this.hasAccess('supervisor');
}

public isAtLeastUser(): boolean {
public isUser(): boolean {
return this.hasAccess('user');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ErrorPageComponent {
});

// if user has no sufficient permissions to use this app
if (!roleService.isAtLeastUser() && !roleService.isAdmin()) {
if (!roleService.isUser() && !roleService.isAdmin()) {
this.actionUrl = '';
this.actionLabel = '';
this.showSignOutButton = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class NotificationActionHelperService {
}

public isAtLeastSupervisor(): boolean {
return this.roleService.isAtLeastSupervisor();
return this.roleService.isSupervisor();
}

public showApproveButton({ status, isFromSender } = {} as Notification): boolean {
Expand Down Expand Up @@ -62,9 +62,9 @@ export class NotificationActionHelperService {

public isAuthorizedForButton(action: NotificationAction): boolean {
if (action === NotificationAction.APPROVE || action === NotificationAction.CLOSE) {
return this.roleService.isAtLeastSupervisor();
return this.roleService.isSupervisor();
} else {
return this.roleService.isAtLeastUser();
return this.roleService.isUser();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export class TableComponent {
icon: 'edit',
action: (data: Record<string, unknown>) => this.editClicked.emit(data),
condition: data => this.isEditable(data),
isAuthorized: this.roleService.isSupervisor(),
};

const menuActionsConfig = menuActions ? [ viewDetailsMenuAction, editDetailsMenuAction, ...menuActions ] : null;
Expand Down