Skip to content

Commit ed70f9f

Browse files
author
Allan Asp Christensen
committed
Organisation admin accessibility
1 parent 3069ca6 commit ed70f9f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
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
@@ -14,7 +14,7 @@
1414
</a>
1515
<fa-icon [icon]="faLayergroup" class="navbar-icon"></fa-icon>
1616
</li>
17-
<div *ngIf="">
17+
<div *ngIf="isOrganisationAdmin(orgSelect.value)">
1818
<li class="nav-item">
1919
<a routerLink="/admin/users" routerLinkActive="active" class="nav-link pl-5 position-relative rounded">
2020
{{'NAV.USERS' | translate}}

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { AfterContentInit, AfterViewChecked, Component, DoCheck, OnChanges, OnInit } from '@angular/core';
22
import { Router } from '@angular/router';
33
import { Organisation } from '@app/admin/organisation/organisation.model';
4+
import { PermissionType } from '@app/admin/permission/permission.model';
45
import { UserResponse } from '@app/admin/users/user.model';
56
import { AuthService } from '@app/auth/auth.service';
67
import { SharedVariableService } from '@app/shared-variable/shared-variable.service';
@@ -12,7 +13,7 @@ import { TranslateService } from '@ngx-translate/core';
1213
templateUrl: './organisation-dropdown.component.html',
1314
styleUrls: ['./organisation-dropdown.component.scss']
1415
})
15-
export class OrganisationDropdownComponent implements OnInit {
16+
export class OrganisationDropdownComponent implements OnInit, OnChanges {
1617
public organisations: Organisation[];
1718
public user: UserResponse;
1819

@@ -33,9 +34,9 @@ export class OrganisationDropdownComponent implements OnInit {
3334
this.getAllowedOrganizations();
3435
}
3536

36-
// ngOnChanges(): void {
37-
// this.getAllowedOrganizations();
38-
// }
37+
ngOnChanges(): void {
38+
this.getAllowedOrganizations();
39+
}
3940

4041
getAllowedOrganizations() {
4142
this.authService.me().subscribe((response) => {
@@ -54,6 +55,10 @@ export class OrganisationDropdownComponent implements OnInit {
5455
});
5556
}
5657

58+
isOrganisationAdmin(orgId: number) {
59+
return this.user.permissions.some(x => x.type === PermissionType.OrganizationAdmin && x.organization.id === +orgId);
60+
}
61+
5762
public onChange(value) {
5863
this.setSelectedOrganisation(value);
5964
this.sharedVariable.setValue(value);

0 commit comments

Comments
 (0)