diff --git a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts index 5c742c6..c5987ba 100644 --- a/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts +++ b/ogWebconsole/src/app/components/admin/users/users/add-user-modal/add-user-modal.component.ts @@ -94,14 +94,20 @@ export class AddUserModalComponent implements OnInit { onSubmit(): void { if (this.userForm.valid) { - const payload = { + const payload: any = { username: this.userForm.value.username, - allowedOrganizationalUnits: this.userForm.value.organizationalUnit, - password: this.userForm.value.password, + allowedOrganizationalUnits: this.userForm.value.organizationalUnits, enabled: true, - userGroups: [this.userForm.value.role ], + userGroups: [this.userForm.value.role], groupsView: this.userForm.value.groupsView }; + + if (!this.userId && this.userForm.value.password) { + payload.password = this.userForm.value.password; + } else if (this.userId && this.userForm.value.password.trim() !== '') { + payload.password = this.userForm.value.password; + } + this.loading = true; if (this.userId) { @@ -109,12 +115,11 @@ export class AddUserModalComponent implements OnInit { (response) => { this.toastService.success('Usuario editado correctamente'); this.dialogRef.close(); - this.loading = false + this.loading = false; }, (error) => { this.toastService.error(error['error']['hydra:description']); - this.loading = false - + this.loading = false; } ); } else { @@ -122,11 +127,11 @@ export class AddUserModalComponent implements OnInit { (response) => { this.toastService.success('Usuario aƱadido correctamente'); this.dialogRef.close(); - this.loading = false + this.loading = false; }, (error) => { this.toastService.error(error['error']['hydra:description']); - this.loading = false + this.loading = false; } ); } diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html index 694f3fd..6eac0b7 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.html +++ b/ogWebconsole/src/app/components/groups/groups.component.html @@ -59,6 +59,18 @@ close + + + + {{ option.name }} + + + + + +