fixed um visibillity

master
FlayInAHook 4 years ago
parent 009ce02301
commit d143bab32d

@ -89,7 +89,7 @@
<!--<app-admin-data-page *ngIf="this.authService.getCurrentUserValue.user.roles.includes('admin')"></app-admin-data-page> <!--<app-admin-data-page *ngIf="this.authService.getCurrentUserValue.user.roles.includes('admin')"></app-admin-data-page>
--> -->
<div id="usermanagement"> <div id="usermanagement" *ngIf="!authService.getCurrentUserValue.user.rolesString.includes('SUPERADMIN')">
<app-admin-data-page></app-admin-data-page> <app-admin-data-page></app-admin-data-page>
</div> </div>

@ -59,6 +59,7 @@ export class ProfileComponent implements OnInit {
let user : User = this.authService.getCurrentUserValue.user; let user : User = this.authService.getCurrentUserValue.user;
user.own_password = this.password.value; user.own_password = this.password.value;
user.password = this.passwordNew.value; user.password = this.passwordNew.value;
this.loading = true; this.loading = true;
this.userService.updateUser(user).subscribe( this.userService.updateUser(user).subscribe(

@ -4,6 +4,7 @@ import { catchError, finalize, map, tap } from 'rxjs/operators';
import { environment } from '../../environments/environment'; import { environment } from '../../environments/environment';
import { Observable, BehaviorSubject, of } from 'rxjs'; import { Observable, BehaviorSubject, of } from 'rxjs';
import { AuthUser } from "../models/user"; import { AuthUser } from "../models/user";
import { JsonPipe } from '@angular/common';
@Injectable({ @Injectable({
@ -32,6 +33,14 @@ export class AuthService {
if (value === null){ if (value === null){
value = new AuthUser(); value = new AuthUser();
} }
if (value.user != undefined){
let roles = [];
for (let role of value.user.roles){
roles.push(role.name);
}
value.user.rolesString = roles.join(', ');
console.log("Getting user" + JSON.stringify(value));
}
return value; return value;
} }

Loading…
Cancel
Save