RED-4704: fix roles not visible when adding a new user
This commit is contained in:
parent
30b74478fd
commit
5d83d3fa2d
@ -27,10 +27,10 @@
|
||||
<label translate="add-edit-user.form.role"></label>
|
||||
<div class="roles-wrapper">
|
||||
<mat-checkbox
|
||||
(change)="setRolesRequirements($event.checked, role)"
|
||||
*ngFor="let role of ROLES"
|
||||
[formControlName]="role"
|
||||
color="primary"
|
||||
(change)="setRolesRequirements($event.checked, role)"
|
||||
>
|
||||
{{ translations[role] | translate }}
|
||||
</mat-checkbox>
|
||||
@ -52,12 +52,12 @@
|
||||
|
||||
<iqser-icon-button
|
||||
(action)="delete()"
|
||||
*ngIf="!disabledDelete(user)"
|
||||
*ngIf="user && !disabledDelete(user)"
|
||||
[label]="'add-edit-user.actions.delete' | translate"
|
||||
[type]="iconButtonTypes.dark"
|
||||
icon="iqser:trash"
|
||||
></iqser-icon-button>
|
||||
|
||||
<div class="all-caps-label cancel" translate="add-edit-user.actions.cancel" (click)="cancel.emit()"></div>
|
||||
<div (click)="cancel.emit()" class="all-caps-label cancel" translate="add-edit-user.actions.cancel"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output } from '@angular/core';
|
||||
import { Component, EventEmitter, Input, OnChanges, Output } from '@angular/core';
|
||||
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms';
|
||||
import { AdminDialogService } from '../../../services/admin-dialog.service';
|
||||
import { BaseFormComponent, IconButtonTypes, LoadingService, Toaster } from '@iqser/common-ui';
|
||||
@ -120,8 +120,8 @@ export class UserDetailsComponent extends BaseFormComponent implements OnChanges
|
||||
}
|
||||
|
||||
disabledDelete(user: User): boolean {
|
||||
const userAdmin = user.roles.includes('RED_ADMIN');
|
||||
const currentUserAdmin = this._userService.currentUser.roles.includes('RED_ADMIN');
|
||||
const userAdmin = user.isAdmin;
|
||||
const currentUserAdmin = this._userService.currentUser.isAdmin;
|
||||
return user.id === this._userService.currentUser.id || (userAdmin && !currentUserAdmin);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user