From 6d54740aafc4582144db7abb5f1d62a8c30476f1 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Mon, 14 Jun 2021 13:12:15 -0500 Subject: [PATCH] [Reset Password] Custom Permission pairing (#1027) --- .../organizations/manage/user-add-edit.component.html | 6 ++++-- src/app/organizations/manage/user-add-edit.component.ts | 9 +++++++++ src/locales/en/messages.json | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app/organizations/manage/user-add-edit.component.html b/src/app/organizations/manage/user-add-edit.component.html index 6f4b54aa80..013bb18835 100644 --- a/src/app/organizations/manage/user-add-edit.component.html +++ b/src/app/organizations/manage/user-add-edit.component.html @@ -172,7 +172,8 @@
+ id="manageUsers" [(ngModel)]="permissions.manageUsers" + (change)="handleDependentPermissions()"> @@ -181,7 +182,8 @@
+ id="manageResetPassword" [(ngModel)]="permissions.manageResetPassword" + (change)="handleDependentPermissions()"> diff --git a/src/app/organizations/manage/user-add-edit.component.ts b/src/app/organizations/manage/user-add-edit.component.ts index 4bda21421a..2281c071f5 100644 --- a/src/app/organizations/manage/user-add-edit.component.ts +++ b/src/app/organizations/manage/user-add-edit.component.ts @@ -143,6 +143,15 @@ export class UserAddEditComponent implements OnInit { return p; } + handleDependentPermissions() { + // Manage Password Reset must have Manage Users enabled + if (this.permissions.manageResetPassword && !this.permissions.manageUsers) { + this.permissions.manageUsers = true; + (document.getElementById('manageUsers') as HTMLInputElement).checked = true; + this.platformUtilsService.showToast('info', null, this.i18nService.t('resetPasswordManageUsers')); + } + } + async submit() { let collections: SelectionReadOnlyRequest[] = null; if (this.access !== 'all') { diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index cd03a666a6..e680001cbf 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -3995,5 +3995,8 @@ }, "error": { "message": "Error" + }, + "resetPasswordManageUsers": { + "message": "Manage Users must also be enabled with the Manage Password Reset permission" } }