Read Only Accounts (#2658)
This commit is contained in:
parent
4f5bb57085
commit
9c84e19960
17 changed files with 155 additions and 65 deletions
|
|
@ -5,7 +5,7 @@
|
|||
<div class="container-fluid row mb-2">
|
||||
<div class="col-10 col-sm-11"><h4>{{t('password-label')}}</h4></div>
|
||||
<div class="col-1 text-end">
|
||||
<button class="btn btn-primary btn-sm" (click)="toggleViewMode()" *ngIf="(hasChangePasswordAbility | async)">{{isViewMode ? t('edit') : t('cancel')}}</button>
|
||||
<button class="btn btn-primary btn-sm" (click)="toggleViewMode()" [disabled]="!(hasChangePasswordAbility | async)">{{isViewMode ? t('edit') : t('cancel')}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ export class ChangePasswordComponent implements OnInit, OnDestroy {
|
|||
|
||||
ngOnInit(): void {
|
||||
|
||||
this.accountService.currentUser$.pipe(takeUntilDestroyed(this.destroyRef), shareReplay(), take(1)).subscribe(user => {
|
||||
this.accountService.currentUser$.pipe(takeUntilDestroyed(this.destroyRef), shareReplay()).subscribe(user => {
|
||||
this.user = user;
|
||||
this.cdRef.markForCheck();
|
||||
});
|
||||
|
||||
this.hasChangePasswordAbility = this.accountService.currentUser$.pipe(takeUntilDestroyed(this.destroyRef), shareReplay(), map(user => {
|
||||
return user !== undefined && (this.accountService.hasAdminRole(user) || this.accountService.hasChangePasswordRole(user));
|
||||
return user !== undefined && !this.accountService.hasReadOnlyRole(user) && (this.accountService.hasAdminRole(user) || this.accountService.hasChangePasswordRole(user));
|
||||
}));
|
||||
this.cdRef.markForCheck();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue