1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-18 01:41:27 +01:00

[Reset Password] Custom Permission pairing (#1027)

This commit is contained in:
Vincent Salucci 2021-06-14 13:12:15 -05:00 committed by GitHub
parent c198ec32bb
commit 6d54740aaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -172,7 +172,8 @@
<div class="form-group mb-0"> <div class="form-group mb-0">
<div class="form-check mt-1 form-check-block"> <div class="form-check mt-1 form-check-block">
<input class="form-check-input" type="checkbox" name="manageUsers" <input class="form-check-input" type="checkbox" name="manageUsers"
id="manageUsers" [(ngModel)]="permissions.manageUsers"> id="manageUsers" [(ngModel)]="permissions.manageUsers"
(change)="handleDependentPermissions()">
<label class="form-check-label font-weight-normal" for="manageUsers"> <label class="form-check-label font-weight-normal" for="manageUsers">
{{'manageUsers' | i18n}} {{'manageUsers' | i18n}}
</label> </label>
@ -181,7 +182,8 @@
<div class="form-group mb-0"> <div class="form-group mb-0">
<div class="form-check mt-1 form-check-block"> <div class="form-check mt-1 form-check-block">
<input class="form-check-input" type="checkbox" name="manageResetPassword" <input class="form-check-input" type="checkbox" name="manageResetPassword"
id="manageResetPassword" [(ngModel)]="permissions.manageResetPassword"> id="manageResetPassword" [(ngModel)]="permissions.manageResetPassword"
(change)="handleDependentPermissions()">
<label class="form-check-label font-weight-normal" for="manageResetPassword"> <label class="form-check-label font-weight-normal" for="manageResetPassword">
{{'manageResetPassword' | i18n}} {{'manageResetPassword' | i18n}}
</label> </label>

View File

@ -143,6 +143,15 @@ export class UserAddEditComponent implements OnInit {
return p; 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() { async submit() {
let collections: SelectionReadOnlyRequest[] = null; let collections: SelectionReadOnlyRequest[] = null;
if (this.access !== 'all') { if (this.access !== 'all') {

View File

@ -3995,5 +3995,8 @@
}, },
"error": { "error": {
"message": "Error" "message": "Error"
},
"resetPasswordManageUsers": {
"message": "Manage Users must also be enabled with the Manage Password Reset permission"
} }
} }