Aside from that, we also just need to make sure that admin users are getting the right data.
@addisonbeck and @differsthecat can you please look at this as you are most familiar with filters.
This ~will~ may be picked to rc
Code changes
angular/src/modules/vault-filter/models/vault-filter.model.ts - add a useAdminCollections flag to VaultFilter. This is because:
conceptually, this model is a record of what ciphers/collections/folders to show the user, so it fits
practically, this model is the main throughline of communication from the Vault component to the VaultFilterService that fetches the collections (which is several layers deep)
we can't just pass the whole organization object, because if the user is applying an org filter in their personal vault, you don't want to show all collections, even if they technically have permissions to access them. We should only fetch all permissions on the org vault page.
angular/src/modules/vault-filter/vault-filter.service.ts - replicate the old code which hits the collections endpoint, and switch based on the useAdminCollections flag
angular/src/modules/vault-filter/vault-filter.component.ts - I encountered an issue where there were duplicate calls to buildCollections, which is more significant now that it involves async network calls.
Type of change
Objective
Fix SG-295: after creating a new collection, you have to refresh the page before it will appear in the vault filters on the organization page.
This is because, pre-End User Vault Refresh, users with
canEditAnyCollection
permissions got their collections directly from the server, rather than synced data: https://github.com/bitwarden/web/blob/v2.28.1/src/app/organizations/vault/groupings.component.ts#L39. Best I can tell, this unintentionally got dropped during EUVR, so it's still pulling from outdated sync data.Aside from that, we also just need to make sure that admin users are getting the right data.
@addisonbeck and @differsthecat can you please look at this as you are most familiar with filters.
This ~will~ may be picked to rc
Code changes
angular/src/modules/vault-filter/models/vault-filter.model.ts - add a
useAdminCollections
flag toVaultFilter
. This is because:VaultFilterService
that fetches the collections (which is several layers deep)organization
object, because if the user is applying an org filter in their personal vault, you don't want to show all collections, even if they technically have permissions to access them. We should only fetch all permissions on the org vault page.angular/src/modules/vault-filter/vault-filter.service.ts - replicate the old code which hits the
collections
endpoint, and switch based on theuseAdminCollections
flagangular/src/modules/vault-filter/vault-filter.component.ts - I encountered an issue where there were duplicate calls to
buildCollections
, which is more significant now that it involves async network calls.VaultFilterComponent.ngOnInit()
. organizationVaultComponent calls it here: https://github.com/bitwarden/web/blob/fix/filters-new-collection/src/app/modules/vault/modules/organization-vault/organization-vault.component.ts#L113 individualVaultComponent calls it here: https://github.com/bitwarden/web/blob/fix/filters-new-collection/src/app/modules/vault/modules/individual-vault/individual-vault.component.ts#L109 desktop still needs this call, but that can be pushed down into its subclass browser does not subclass this at all and is unaffected by this change * now,initCollections
is not called by anything, so it can be removed.Before you submit
npm run lint
) (required)