1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-29 17:38:04 +01:00

[AC-2771] [AC-2772] Provider Restriction Fixes (#9635)

* [AC-2771] Do not make API request when restricted provider is not a member of the org

* [AC-2771] Fix console errors when switching organizations

* [AC-2772] Fix org vault for providers who are members
- Show vault filters
- Hide header search bar
- Show create new item button
This commit is contained in:
Shane Melton 2024-06-13 13:18:49 -07:00 committed by GitHub
parent 2d43a12ce9
commit 2ff9c3bb76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 6 deletions

View File

@ -69,9 +69,9 @@ export class VaultCollectionRowComponent {
if (this.collection instanceof CollectionAdminView) { if (this.collection instanceof CollectionAdminView) {
// Only show AddAccess if unmanaged and allowAdminAccessToAllCollectionItems is disabled // Only show AddAccess if unmanaged and allowAdminAccessToAllCollectionItems is disabled
return ( return (
!this.organization.allowAdminAccessToAllCollectionItems && !this.organization?.allowAdminAccessToAllCollectionItems &&
this.collection.unmanaged && this.collection.unmanaged &&
this.organization.canEditUnmanagedCollections() this.organization?.canEditUnmanagedCollections()
); );
} }

View File

@ -93,7 +93,7 @@
</ng-container> </ng-container>
<bit-search <bit-search
*ngIf="organization?.isProviderUser" *ngIf="restrictProviderAccessFlag && organization?.isProviderUser && !organization?.isMember"
class="tw-grow" class="tw-grow"
[ngModel]="searchText" [ngModel]="searchText"
(ngModelChange)="onSearchTextChanged($event)" (ngModelChange)="onSearchTextChanged($event)"

View File

@ -68,7 +68,7 @@ export class VaultHeaderComponent implements OnInit {
protected organizations$ = this.organizationService.organizations$; protected organizations$ = this.organizationService.organizations$;
protected flexibleCollectionsV1Enabled = false; protected flexibleCollectionsV1Enabled = false;
private restrictProviderAccessFlag = false; protected restrictProviderAccessFlag = false;
constructor( constructor(
private organizationService: OrganizationService, private organizationService: OrganizationService,
@ -220,7 +220,11 @@ export class VaultHeaderComponent implements OnInit {
} }
get canCreateCipher(): boolean { get canCreateCipher(): boolean {
if (this.organization?.isProviderUser && this.restrictProviderAccessFlag) { if (
this.organization?.isProviderUser &&
this.restrictProviderAccessFlag &&
!this.organization?.isMember
) {
return false; return false;
} }
return true; return true;

View File

@ -166,7 +166,11 @@ export class VaultComponent implements OnInit, OnDestroy {
} }
protected get hideVaultFilters(): boolean { protected get hideVaultFilters(): boolean {
return this.restrictProviderAccessEnabled && this.organization?.isProviderUser; return (
this.restrictProviderAccessEnabled &&
this.organization?.isProviderUser &&
!this.organization?.isMember
);
} }
private searchText$ = new Subject<string>(); private searchText$ = new Subject<string>();
@ -352,6 +356,16 @@ export class VaultComponent implements OnInit, OnDestroy {
} }
let ciphers; let ciphers;
// Restricted providers (who are not members) do not have access org cipher endpoint below
// Return early to avoid 404 response
if (
this.restrictProviderAccessEnabled &&
!organization.isMember &&
organization.isProviderUser
) {
return [];
}
if (this.flexibleCollectionsV1Enabled) { if (this.flexibleCollectionsV1Enabled) {
// Flexible collections V1 logic. // Flexible collections V1 logic.
// If the user can edit all ciphers for the organization then fetch them ALL. // If the user can edit all ciphers for the organization then fetch them ALL.