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>
|
||||||
<mat-form-field class="mat-block">
|
<mat-form-field class="mat-block">
|
||||||
<mat-label translate>language.language</mat-label>
|
<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">
|
<mat-option *ngFor="let lang of languageList" [value]="lang">
|
||||||
{{ lang ? ('language.locales.' + lang | translate) : ''}}
|
{{ lang ? ('language.locales.' + lang | translate) : ''}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</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
|
<tb-dashboard-autocomplete
|
||||||
fxFlex
|
fxFlex
|
||||||
placeholder="{{ 'dashboard.home-dashboard' | translate }}"
|
placeholder="{{ 'dashboard.home-dashboard' | translate }}"
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { UserService } from '@core/http/user.service';
|
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 { Authority } from '@shared/models/authority.enum';
|
||||||
import { PageComponent } from '@shared/components/page.component';
|
import { PageComponent } from '@shared/components/page.component';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
@ -33,6 +33,7 @@ import { DialogService } from '@core/services/dialog.service';
|
|||||||
import { AuthService } from '@core/auth/auth.service';
|
import { AuthService } from '@core/auth/auth.service';
|
||||||
import { ActivatedRoute } from '@angular/router';
|
import { ActivatedRoute } from '@angular/router';
|
||||||
import { isDefinedAndNotNull } from '@core/utils';
|
import { isDefinedAndNotNull } from '@core/utils';
|
||||||
|
import { getCurrentAuthUser } from '@core/auth/auth.selectors';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'tb-profile',
|
selector: 'tb-profile',
|
||||||
@ -45,6 +46,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir
|
|||||||
profile: FormGroup;
|
profile: FormGroup;
|
||||||
user: User;
|
user: User;
|
||||||
languageList = env.supportedLangs;
|
languageList = env.supportedLangs;
|
||||||
|
private readonly authUser: AuthUser;
|
||||||
|
|
||||||
constructor(protected store: Store<AppState>,
|
constructor(protected store: Store<AppState>,
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
@ -55,6 +57,7 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir
|
|||||||
public dialogService: DialogService,
|
public dialogService: DialogService,
|
||||||
public fb: FormBuilder) {
|
public fb: FormBuilder) {
|
||||||
super(store);
|
super(store);
|
||||||
|
this.authUser = getCurrentAuthUser(this.store);
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -134,4 +137,8 @@ export class ProfileComponent extends PageComponent implements OnInit, HasConfir
|
|||||||
return this.profile;
|
return this.profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isSysAdmin(): boolean {
|
||||||
|
return this.authUser.authority === Authority.SYS_ADMIN;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user