[PM-7215] User with Can View permission can remove passkey or delete URIs from UI, though it isn't saved (#9607)

* Removed - button on passkeys and uris when user has view only access, disabled cog button and made input fields on uris readonly when user has view only access

(cherry picked from commit 077edd77c1)

* switched to use viewonly to hide remove button

(cherry picked from commit dbd854494f)
This commit is contained in:
SmithThe4th 2024-06-20 10:59:11 -04:00 committed by GitHub
parent 639debe91b
commit eadb1fa4ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View File

@ -144,6 +144,7 @@
appStopClick appStopClick
(click)="removePasskey()" (click)="removePasskey()"
appA11yTitle="{{ 'removePasskey' | i18n }}" appA11yTitle="{{ 'removePasskey' | i18n }}"
*ngIf="!(!cipher.edit && editMode)"
> >
<i class="bwi bwi-fw bwi-minus-circle bwi-lg" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-minus-circle bwi-lg" aria-hidden="true"></i>
</button> </button>
@ -542,6 +543,7 @@
> >
<button <button
type="button" type="button"
*ngIf="!(!cipher.edit && editMode)"
appStopClick appStopClick
(click)="removeUri(u)" (click)="removeUri(u)"
appA11yTitle="{{ 'remove' | i18n }}" appA11yTitle="{{ 'remove' | i18n }}"
@ -558,6 +560,7 @@
[hidden]="$any(u).showUriOptionsInput === true" [hidden]="$any(u).showUriOptionsInput === true"
placeholder="{{ 'ex' | i18n }} https://google.com" placeholder="{{ 'ex' | i18n }} https://google.com"
inputmode="url" inputmode="url"
[readonly]="!cipher.edit && editMode"
appInputVerbatim appInputVerbatim
/> />
<label for="loginUriMatch{{ i }}" class="sr-only"> <label for="loginUriMatch{{ i }}" class="sr-only">
@ -607,6 +610,7 @@
appA11yTitle="{{ 'toggleOptions' | i18n }}" appA11yTitle="{{ 'toggleOptions' | i18n }}"
(click)="toggleUriOptions(u)" (click)="toggleUriOptions(u)"
[attr.aria-pressed]="$any(u).showOptions === true" [attr.aria-pressed]="$any(u).showOptions === true"
[disabled]="!cipher.edit && editMode"
> >
<i class="bwi bwi-fw bwi-lg bwi-cog" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-lg bwi-cog" aria-hidden="true"></i>
</button> </button>

View File

@ -127,7 +127,7 @@
appStopClick appStopClick
(click)="removePasskey()" (click)="removePasskey()"
appA11yTitle="{{ 'removePasskey' | i18n }}" appA11yTitle="{{ 'removePasskey' | i18n }}"
[disabled]="!cipher.edit && editMode" *ngIf="!(!cipher.edit && editMode)"
> >
<i class="bwi bwi-fw bwi-minus-circle bwi-lg" aria-hidden="true"></i> <i class="bwi bwi-fw bwi-minus-circle bwi-lg" aria-hidden="true"></i>
</button> </button>
@ -488,7 +488,7 @@
appStopClick appStopClick
(click)="removeUri(u)" (click)="removeUri(u)"
appA11yTitle="{{ 'remove' | i18n }}" appA11yTitle="{{ 'remove' | i18n }}"
[disabled]="!cipher.edit && editMode" *ngIf="!(!cipher.edit && editMode)"
> >
<i class="bwi bwi-minus-circle bwi-lg" aria-hidden="true"></i> <i class="bwi bwi-minus-circle bwi-lg" aria-hidden="true"></i>
</button> </button>
@ -500,6 +500,7 @@
name="Login.Uris[{{ i }}].Uri" name="Login.Uris[{{ i }}].Uri"
[(ngModel)]="u.uri" [(ngModel)]="u.uri"
placeholder="{{ 'ex' | i18n }} https://google.com" placeholder="{{ 'ex' | i18n }} https://google.com"
[readonly]="!cipher.edit && editMode"
appInputVerbatim appInputVerbatim
/> />
<label for="loginUriMatch{{ i }}" class="sr-only"> <label for="loginUriMatch{{ i }}" class="sr-only">
@ -533,6 +534,7 @@
($any(u).showOptions == null && u.match == null) ($any(u).showOptions == null && u.match == null)
) )
" "
[disabled]="!cipher.edit && editMode"
> >
<i class="bwi bwi-lg bwi-cog" aria-hidden="true"></i> <i class="bwi bwi-lg bwi-cog" aria-hidden="true"></i>
</button> </button>

View File

@ -94,6 +94,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit, On
async ngOnInit() { async ngOnInit() {
await super.ngOnInit(); await super.ngOnInit();
await this.load(); await this.load();
this.viewOnly = !this.cipher.edit && this.editMode;
// remove when all the title for all clients are updated to New Item // remove when all the title for all clients are updated to New Item
if (this.cloneMode || !this.editMode) { if (this.cloneMode || !this.editMode) {
this.title = this.i18nService.t("newItem"); this.title = this.i18nService.t("newItem");