Updated user service to use different endpoint
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
<ul class="my-account__list">
|
||||
<li class="my-account__list-item" *ngFor="let role of allRoles">
|
||||
<digi-icon-check-circle
|
||||
*ngIf="userHasRole(user.roles, role); else unauthorized"
|
||||
*ngIf="user.roles.includes(role.type); else unauthorized"
|
||||
class="msfa__digi-icon my-account__authorization-icon my-account__authorization-icon--authorized"
|
||||
></digi-icon-check-circle>
|
||||
<ng-template #unauthorized>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { IconType } from '@msfa-enums/icon-type.enum';
|
||||
import { Employee } from '@msfa-models/employee.model';
|
||||
import { Organization } from '@msfa-models/organization.model';
|
||||
import { Role } from '@msfa-models/role.model';
|
||||
import { User } from '@msfa-models/user.model';
|
||||
import { UserService } from '@msfa-services/api/user.service';
|
||||
import { RoleService } from '@msfa-services/role.service';
|
||||
import { combineLatest, Observable } from 'rxjs';
|
||||
@@ -16,7 +16,7 @@ import { filter, map } from 'rxjs/operators';
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class MyAccountComponent {
|
||||
user$: Observable<User> = this.userService.user$;
|
||||
user$: Observable<Employee> = this.userService.user$;
|
||||
selectedOrganization$: Observable<Organization> = this.userService.selectedOrganization$;
|
||||
organizations$: Observable<Organization[]> = this.userService.organizations$;
|
||||
otherOrganizations$: Observable<Organization[]> = combineLatest([
|
||||
@@ -33,10 +33,6 @@ export class MyAccountComponent {
|
||||
|
||||
constructor(private userService: UserService, private roleService: RoleService, private router: Router) {}
|
||||
|
||||
userHasRole(userRoles: Role[], currentRole: Role): boolean {
|
||||
return userRoles.some(role => role.type === currentRole.type);
|
||||
}
|
||||
|
||||
loginWithOrganization(organization: Organization): void {
|
||||
this.userService.setSelectedOrganization(organization);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { DigiNgSkeletonBaseModule } from '@af/digi-ng/_skeleton/skeleton-base';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { HideTextModule } from '@msfa-shared/components/hide-text/hide-text.module';
|
||||
import { IconModule } from '@msfa-shared/components/icon/icon.module';
|
||||
import { LayoutModule } from '@msfa-shared/components/layout/layout.module';
|
||||
import { OrganizationPickerFormModule } from '@msfa-shared/components/organization-picker-form/organization-picker-form.module';
|
||||
@@ -19,6 +20,7 @@ import { MyAccountComponent } from './my-account.component';
|
||||
DigiNgSkeletonBaseModule,
|
||||
OrganizationPickerFormModule,
|
||||
RolesDialogModule,
|
||||
HideTextModule,
|
||||
],
|
||||
})
|
||||
export class MyAccountModule {}
|
||||
|
||||
Reference in New Issue
Block a user