From 0287d0ebd22b88c2d41f2bdb67db812c35d9024c Mon Sep 17 00:00:00 2001 From: benal01 Date: Mon, 17 Mar 2025 18:42:40 -0400 Subject: hide admin only management elements if user is not an admin --- ufund-ui/src/app/components/need-list/need-list.component.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ufund-ui/src/app/components/need-list/need-list.component.ts') diff --git a/ufund-ui/src/app/components/need-list/need-list.component.ts b/ufund-ui/src/app/components/need-list/need-list.component.ts index 8451d5b..6ad9397 100644 --- a/ufund-ui/src/app/components/need-list/need-list.component.ts +++ b/ufund-ui/src/app/components/need-list/need-list.component.ts @@ -1,7 +1,8 @@ import { Component } from '@angular/core'; import {Need} from '../../models/Need'; import {CupboardService} from '../../services/cupboard.service'; - +import { UsersService } from '../../services/users.service'; +import { userType } from '../../models/User'; @Component({ selector: 'app-need-list', standalone: false, @@ -13,7 +14,8 @@ export class NeedListComponent { searchResults: Need[] = []; constructor( - private cupboardService: CupboardService + private cupboardService: CupboardService, + private usersService: UsersService ) {} ngOnInit(): void { @@ -85,6 +87,10 @@ export class NeedListComponent { }) } + isManager() { + return this.usersService.getCurrentUser()?.type == userType.MANAGER; + } + back() { this.searchResults = []; } -- cgit v1.2.3