Commit bca450dbe1012f5c61b94815547fbb348ff2e4ac
1 parent
5bb252b4
UI: Fixed error access is forbidden in the system admin change profile
Showing
2 changed files
with
10 additions
and
3 deletions
@@ -57,13 +57,13 @@ | @@ -57,13 +57,13 @@ | ||
57 | </mat-form-field> | 57 | </mat-form-field> |
58 | <mat-form-field class="mat-block"> | 58 | <mat-form-field class="mat-block"> |
59 | <mat-label translate>language.language</mat-label> | 59 | <mat-label translate>language.language</mat-label> |
60 | - <mat-select matInput formControlName="language"> | 60 | + <mat-select formControlName="language"> |
61 | <mat-option *ngFor="let lang of languageList" [value]="lang"> | 61 | <mat-option *ngFor="let lang of languageList" [value]="lang"> |
62 | {{ lang ? ('language.locales.' + lang | translate) : ''}} | 62 | {{ lang ? ('language.locales.' + lang | translate) : ''}} |
63 | </mat-option> | 63 | </mat-option> |
64 | </mat-select> | 64 | </mat-select> |
65 | </mat-form-field> | 65 | </mat-form-field> |
66 | - <section class="tb-home-dashboard" fxFlex fxLayout="column" fxLayout.gt-sm="row"> | 66 | + <section class="tb-home-dashboard" fxFlex fxLayout="column" fxLayout.gt-sm="row" *ngIf="!isSysAdmin()"> |
67 | <tb-dashboard-autocomplete | 67 | <tb-dashboard-autocomplete |
68 | fxFlex | 68 | fxFlex |
69 | placeholder="{{ 'dashboard.home-dashboard' | translate }}" | 69 | placeholder="{{ 'dashboard.home-dashboard' | translate }}" |
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | 16 | ||
17 | import { Component, OnInit } from '@angular/core'; | 17 | import { Component, OnInit } from '@angular/core'; |
18 | import { UserService } from '@core/http/user.service'; | 18 | import { UserService } from '@core/http/user.service'; |
19 | -import { User } from '@shared/models/user.model'; | 19 | +import { AuthUser, User } from '@shared/models/user.model'; |
20 | import { Authority } from '@shared/models/authority.enum'; | 20 | import { Authority } from '@shared/models/authority.enum'; |
21 | import { PageComponent } from '@shared/components/page.component'; | 21 | import { PageComponent } from '@shared/components/page.component'; |
22 | import { Store } from '@ngrx/store'; | 22 | import { Store } from '@ngrx/store'; |
@@ -33,6 +33,7 @@ import { DialogService } from '@core/services/dialog.service'; | @@ -33,6 +33,7 @@ import { DialogService } from '@core/services/dialog.service'; | ||
33 | import { AuthService } from '@core/auth/auth.service'; | 33 | import { AuthService } from '@core/auth/auth.service'; |
34 | import { ActivatedRoute } from '@angular/router'; | 34 | import { ActivatedRoute } from '@angular/router'; |
35 | import { isDefinedAndNotNull } from '@core/utils'; | 35 | import { isDefinedAndNotNull } from '@core/utils'; |
36 | +import { getCurrentAuthUser } from '@core/auth/auth.selectors'; | ||
36 | 37 | ||
37 | @Component({ | 38 | @Component({ |
38 | selector: 'tb-profile', | 39 | selector: 'tb-profile', |
@@ -45,6 +46,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir | @@ -45,6 +46,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir | ||
45 | profile: FormGroup; | 46 | profile: FormGroup; |
46 | user: User; | 47 | user: User; |
47 | languageList = env.supportedLangs; | 48 | languageList = env.supportedLangs; |
49 | + private readonly authUser: AuthUser; | ||
48 | 50 | ||
49 | constructor(protected store: Store<AppState>, | 51 | constructor(protected store: Store<AppState>, |
50 | private route: ActivatedRoute, | 52 | private route: ActivatedRoute, |
@@ -55,6 +57,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir | @@ -55,6 +57,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir | ||
55 | public dialogService: DialogService, | 57 | public dialogService: DialogService, |
56 | public fb: FormBuilder) { | 58 | public fb: FormBuilder) { |
57 | super(store); | 59 | super(store); |
60 | + this.authUser = getCurrentAuthUser(this.store); | ||
58 | } | 61 | } |
59 | 62 | ||
60 | ngOnInit() { | 63 | ngOnInit() { |
@@ -134,4 +137,8 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir | @@ -134,4 +137,8 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir | ||
134 | return this.profile; | 137 | return this.profile; |
135 | } | 138 | } |
136 | 139 | ||
140 | + isSysAdmin(): boolean { | ||
141 | + return this.authUser.authority === Authority.SYS_ADMIN; | ||
142 | + } | ||
143 | + | ||
137 | } | 144 | } |