Skip to content

Commit 49c63cc

Browse files
committed
User with org admin and global admin now only see one user and permission group in nav bar
1 parent 45231e0 commit 49c63cc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/app/navbar/organisation-dropdown/organisation-dropdown.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</a>
2626
<fa-icon [icon]="faBurn" class="navbar-icon"></fa-icon>
2727
</li>
28-
<div *ngIf="user && isOrgAdmin">
28+
<div *ngIf="user && isOrgAdmin && !isGlobalAdmin">
2929
<li class="nav-item">
3030
<a routerLink="/admin/users" routerLinkActive="active" class="nav-link pl-5 position-relative rounded">
3131
{{'NAV.USERS' | translate}}

src/app/navbar/organisation-dropdown/organisation-dropdown.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export class OrganisationDropdownComponent implements OnInit {
1616
public organisations: Organisation[];
1717
public user: UserResponse;
1818
public isOrgAdmin = false;
19+
public isGlobalAdmin = false;
1920

2021
faExchangeAlt = faExchangeAlt;
2122
faLayergroup = faLayerGroup;
@@ -49,16 +50,17 @@ export class OrganisationDropdownComponent implements OnInit {
4950
) {
5051
this.setSelectedOrganisation(userInfo.organizations[0]?.id);
5152
}
52-
this.isOrganisationAdmin(userInfo.organizations[0]?.id);
53+
this.setLocalPermissionCheck(userInfo.organizations[0]?.id);
5354
}
5455

55-
private isOrganisationAdmin(orgId: number) {
56+
private setLocalPermissionCheck(orgId: number) {
5657
this.isOrgAdmin = this.user?.permissions?.some(x => x.type == PermissionType.OrganizationAdmin && x.organization.id === +orgId);
58+
this.isGlobalAdmin = this.user?.permissions?.some( permission => permission.type === PermissionType.GlobalAdmin);
5759
}
5860

5961
public onChange(organizationId: string) {
6062
this.sharedVariableService.setValue(+organizationId);
61-
this.isOrganisationAdmin(+organizationId);
63+
this.setLocalPermissionCheck(+organizationId);
6264
this.route.navigateByUrl('/', {skipLocationChange: true}).then(()=>
6365
this.route.navigate(['applications']));
6466
}

0 commit comments

Comments
 (0)