mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 00:03:56 +00:00
[PM-15506] Implement vNextOrganizationService (#12839)
* [PM-15506] Wire up vNextOrganizationService for libs/common and libs/angular (#12683) * Wire up vNextOrganizationService in PolicyService * Wire vNextOrganizationService in SyncService * wire vNextOrganizationService for EventCollectionService * wire vNextOrganizationService for KeyConnectorService * wire up vNextOrganizationService for CipherAuthorizationService * Wire up vNextOrganizationService in PolicyService * Wire vNextOrganizationService in SyncService * wire vNextOrganizationService for EventCollectionService * wire vNextOrganizationService for KeyConnectorService * wire up vNextOrganizationService for CipherAuthorizationService * wire vNextOrganizationService for share.component * wire vNextOrganizationService for collections.component * wire vNextOrganizationServcie for add-account-credit-dialog * wire vNextOrganizationService for vault-filter.service * fix browser errors for vNextOrganizationService implementation in libs * fix desktop errors for vNextOrganizationService implementation for libs * fix linter errors * fix CLI errors on vNextOrganizationServcie implementations for libs * [PM-15506] Wire up vNextOrganizationService for web client (#12810) PR to a feature branch, no need to review until this goes to main. * implement vNextOrganization service for browser client (#12844) PR to feature branch, no need for review yet. * wire vNextOrganizationService for licence and some web router guards * wire vNextOrganizationService in tests * remove vNext notation for OrganizationService and related * Merge branch 'main' into ac/pm-15506-vNextOrganizationService * fix tsstrict error * fix test, fix ts strict error
This commit is contained in:
@@ -17,6 +17,7 @@ import { AccountService } from "@bitwarden/common/auth/abstractions/account.serv
|
||||
import { AuthService } from "@bitwarden/common/auth/abstractions/auth.service";
|
||||
import { KeyConnectorService } from "@bitwarden/common/auth/abstractions/key-connector.service";
|
||||
import { AuthenticationStatus } from "@bitwarden/common/auth/enums/authentication-status";
|
||||
import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
||||
import { ProcessReloadServiceAbstraction } from "@bitwarden/common/key-management/abstractions/process-reload.service";
|
||||
import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broadcaster.service";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
@@ -219,7 +220,10 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
break;
|
||||
case "syncOrganizationStatusChanged": {
|
||||
const { organizationId, enabled } = message;
|
||||
const organizations = await firstValueFrom(this.organizationService.organizations$);
|
||||
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
||||
const organizations = await firstValueFrom(
|
||||
this.organizationService.organizations$(userId),
|
||||
);
|
||||
const organization = organizations.find((org) => org.id === organizationId);
|
||||
|
||||
if (organization) {
|
||||
@@ -227,21 +231,27 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
...organization,
|
||||
enabled: enabled,
|
||||
};
|
||||
await this.organizationService.upsert(updatedOrganization);
|
||||
await this.organizationService.upsert(updatedOrganization, userId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "syncOrganizationCollectionSettingChanged": {
|
||||
const { organizationId, limitCollectionCreation, limitCollectionDeletion } = message;
|
||||
const organizations = await firstValueFrom(this.organizationService.organizations$);
|
||||
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
||||
const organizations = await firstValueFrom(
|
||||
this.organizationService.organizations$(userId),
|
||||
);
|
||||
const organization = organizations.find((org) => org.id === organizationId);
|
||||
|
||||
if (organization) {
|
||||
await this.organizationService.upsert({
|
||||
...organization,
|
||||
limitCollectionCreation: limitCollectionCreation,
|
||||
limitCollectionDeletion: limitCollectionDeletion,
|
||||
});
|
||||
await this.organizationService.upsert(
|
||||
{
|
||||
...organization,
|
||||
limitCollectionCreation: limitCollectionCreation,
|
||||
limitCollectionDeletion: limitCollectionDeletion,
|
||||
},
|
||||
userId,
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -291,7 +301,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
// will prevent any toasts from being displayed long enough to be read
|
||||
|
||||
await this.eventUploadService.uploadEvents();
|
||||
const userId = await firstValueFrom(this.accountService.activeAccount$.pipe(map((a) => a?.id)));
|
||||
const userId = await firstValueFrom(getUserId(this.accountService.activeAccount$));
|
||||
|
||||
const logoutPromise = firstValueFrom(
|
||||
this.authService.authStatusFor$(userId).pipe(
|
||||
|
||||
Reference in New Issue
Block a user