fix(user-managment): non-admin users must be assigned atleast one lib… (#1741)
Co-authored-by: James Ward <james@notjam.es>
This commit is contained in:
co-authored by
James Ward
parent
64ddbe550c
commit
2b8ac7393e
@@ -163,6 +163,7 @@
|
||||
[outlined]="true"
|
||||
[rounded]="true"
|
||||
(onClick)="saveUser(user)"
|
||||
[disabled] = "!editUserBtnEnabled(user)"
|
||||
[pTooltip]="t('actions.saveChanges')">
|
||||
</p-button>
|
||||
<p-button
|
||||
@@ -215,6 +216,14 @@
|
||||
appendTo="body"
|
||||
[disabled]="user.permissions.admin">
|
||||
</p-multiSelect>
|
||||
@if (editingLibraryIds.length === 0 && !user.permissions.admin) {
|
||||
<div class="form-field">
|
||||
<small class="field-error">
|
||||
<i class="pi pi-exclamation-circle"></i>
|
||||
{{ t('createDialog.libraryRequired') }}
|
||||
</small>
|
||||
</div>
|
||||
}
|
||||
} @else {
|
||||
<span>{{ getLibraryAccessLabel(user) }}</span>
|
||||
}
|
||||
|
||||
@@ -624,6 +624,19 @@
|
||||
::ng-deep .p-password {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.field-error {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.3281rem;
|
||||
color: #ef4444;
|
||||
font-size: var(--app-text-sm);
|
||||
margin-top: -0.2188rem;
|
||||
|
||||
i {
|
||||
font-size: var(--app-text-sm);
|
||||
}
|
||||
}
|
||||
|
||||
::ng-deep .p-inputtext,
|
||||
::ng-deep .p-password-input {
|
||||
|
||||
@@ -343,4 +343,8 @@ export class UserManagementComponent implements OnInit {
|
||||
isPermissionDisabled(user: UserWithEditing): boolean {
|
||||
return !user.isEditing || user.permissions.admin;
|
||||
}
|
||||
|
||||
editUserBtnEnabled(user: User) : boolean {
|
||||
return !(this.editingLibraryIds.length === 0 && !user.permissions.admin);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user