1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-11 05:43:41 +00:00

[PM-12770] Assign to Collections Hint (#14529)

* allow use of common spec in lib/vault tests

* pass readonly collections to the assign collection component

- The assign to collections component filters them out already.
-They're also needed to display copy within the component

* add hint to assign to collections component when there are read only collections assigned to a cipher already

* add readonly hint to desktop

* only show collection hint for collections that are assigned to the provided ciphers

* consider admin/owner edit everything permission when assigning to collections

* fix icon in test
This commit is contained in:
Nick Krantz
2025-05-22 11:09:33 -05:00
committed by GitHub
parent 9417d8a943
commit f52e4e27a0
8 changed files with 165 additions and 8 deletions

View File

@@ -74,7 +74,7 @@ export class AssignCollections {
combineLatest([cipher$, this.collectionService.decryptedCollections$])
.pipe(takeUntilDestroyed(), first())
.subscribe(([cipherView, collections]) => {
let availableCollections = collections.filter((c) => !c.readOnly);
let availableCollections = collections;
const organizationId = (cipherView?.organizationId as OrganizationId) ?? null;
// If the cipher is already a part of an organization,

View File

@@ -3703,6 +3703,15 @@
"changeAtRiskPassword": {
"message": "Change at-risk password"
},
"cannotRemoveViewOnlyCollections": {
"message": "You cannot remove collections with View only permissions: $COLLECTIONS$",
"placeholders": {
"collections": {
"content": "$1",
"example": "Work, Personal"
}
}
},
"move": {
"message": "Move"
},

View File

@@ -362,8 +362,7 @@ export class VaultComponent implements OnInit, OnDestroy {
if (this.organization.canEditAllCiphers) {
return collections;
}
// The user is only allowed to add/edit items to assigned collections that are not readonly
return collections.filter((c) => c.assigned && !c.readOnly);
return collections.filter((c) => c.assigned);
}),
shareReplay({ refCount: true, bufferSize: 1 }),
);

View File

@@ -933,7 +933,7 @@ export class VaultComponent implements OnInit, OnDestroy {
if (orgId && orgId !== "MyVault") {
const organization = this.allOrganizations.find((o) => o.id === orgId);
availableCollections = this.allCollections.filter(
(c) => c.organizationId === organization.id && !c.readOnly,
(c) => c.organizationId === organization.id,
);
}