Merge pull request #4318 from vvlladd28/bug/profiles/sys-admin/select-home-dashboard
UI: Fixed error access is forbidden in the system admin change profile
This commit is contained in:
commit
477d640e65
@ -57,13 +57,13 @@
|
||||
</mat-form-field>
|
||||
<mat-form-field class="mat-block">
|
||||
<mat-label translate>language.language</mat-label>
|
||||
<mat-select matInput formControlName="language">
|
||||
<mat-select formControlName="language">
|
||||
<mat-option *ngFor="let lang of languageList" [value]="lang">
|
||||
{{ lang ? ('language.locales.' + lang | translate) : ''}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<section class="tb-home-dashboard" fxFlex fxLayout="column" fxLayout.gt-sm="row">
|
||||
<section class="tb-home-dashboard" fxFlex fxLayout="column" fxLayout.gt-sm="row" *ngIf="!isSysAdmin()">
|
||||
<tb-dashboard-autocomplete
|
||||
fxFlex
|
||||
placeholder="{{ 'dashboard.home-dashboard' | translate }}"
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { UserService } from '@core/http/user.service';
|
||||
import { User } from '@shared/models/user.model';
|
||||
import { AuthUser, User } from '@shared/models/user.model';
|
||||
import { Authority } from '@shared/models/authority.enum';
|
||||
import { PageComponent } from '@shared/components/page.component';
|
||||
import { Store } from '@ngrx/store';
|
||||
@ -33,6 +33,7 @@ import { DialogService } from '@core/services/dialog.service';
|
||||
import { AuthService } from '@core/auth/auth.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { isDefinedAndNotNull } from '@core/utils';
|
||||
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
|
||||
|
||||
@Component({
|
||||
selector: 'tb-profile',
|
||||
@ -45,6 +46,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir
|
||||
profile: FormGroup;
|
||||
user: User;
|
||||
languageList = env.supportedLangs;
|
||||
private readonly authUser: AuthUser;
|
||||
|
||||
constructor(protected store: Store<AppState>,
|
||||
private route: ActivatedRoute,
|
||||
@ -55,6 +57,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir
|
||||
public dialogService: DialogService,
|
||||
public fb: FormBuilder) {
|
||||
super(store);
|
||||
this.authUser = getCurrentAuthUser(this.store);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@ -134,4 +137,8 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir
|
||||
return this.profile;
|
||||
}
|
||||
|
||||
isSysAdmin(): boolean {
|
||||
return this.authUser.authority === Authority.SYS_ADMIN;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user