Skip to content

Commit

Permalink
[#986] Show zk memebr functionalities to pak user (#997)
Browse files Browse the repository at this point in the history
- show funcitonalitites in map dropdown to pak user
  • Loading branch information
danielkryska authored Dec 4, 2020
1 parent 4bf241e commit 600608e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 5 additions & 0 deletions s4e-web/src/app/state/session/session.query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ export class SessionQuery extends Query<Session> {
return this.getValue().admin;
}

selectPakMember() {
return this.select('authorities')
.pipe(map(authorities => authorities.some(authority => authority === 'ROLE_MEMBER_PAK')));
}

canDeleteInstitution() {
return this.getValue().authorities.includes('OP_INSTITUTION_DELETE') || this.getValue().admin;
}
Expand Down
2 changes: 1 addition & 1 deletion s4e-web/src/app/views/map-view/map-view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</button>
<ng-container *ngIf="showLoginOptions$ | async">
<s4e-user-dropdown
[showAdvanced]="userIsZK$ | async"
[showAdvanced]="userIsAuthorizedForAdditionalFunctionalities$ | async"
[userLoggedIn]="userLoggedIn$ | async"
[hasHeightContrast]="hasHeightContrast$ | async"
[hasLargeFont]="hasLargeFont$ | async"
Expand Down
7 changes: 5 additions & 2 deletions s4e-web/src/app/views/map-view/map-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {REPORT_TEMPLATES_MODAL_ID} from './zk/report-templates-modal/report-temp
import {ReportTemplateQuery} from './zk/state/report-templates/report-template.query';
import {ReportTemplateStore} from './zk/state/report-templates/report-template.store';
import {ViewConfigurationService} from './state/view-configuration/view-configuration.service';
import {filterFalse, filterNotNull} from '../../utils/rxjs/observable';
import {filterFalse, filterNotNull, mapAnyTrue} from '../../utils/rxjs/observable';


@Component({
Expand Down Expand Up @@ -83,7 +83,10 @@ export class MapViewComponent implements OnInit, OnDestroy {
public showProductDescription$: Observable<boolean> = this.mapQuery.selectShowProductDescription();
public selectedLocation$: Observable<LocationSearchResult | null>;
public overlays$: Observable<UIOverlay[]> = this.overlayQuery.selectVisibleAsUIOverlays();
public userIsZK$: Observable<boolean> = this.sessionQuery.selectMemberZK();
public userIsAuthorizedForAdditionalFunctionalities$: Observable<boolean> = combineLatest([
this.sessionQuery.selectPakMember(),
this.sessionQuery.selectMemberZK()
]).pipe(mapAnyTrue());
public timelineResolution$: Observable<number> = this.productQuery.selectTimelineResolution();
public legend$ = this.legendQuery.selectLegend();
public hasHeightContrast$ = this.viewConfigurationQuery.select('highContrast');
Expand Down

0 comments on commit 600608e

Please sign in to comment.