1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

[AC-1139] Override deprecated values on sync

This commit is contained in:
Rui Tome
2023-11-28 16:13:45 +00:00
parent 04fb7c04c2
commit 9cfe891bef
4 changed files with 20 additions and 0 deletions

View File

@@ -536,6 +536,7 @@ export default class MainBackground {
this.folderApiService, this.folderApiService,
this.organizationService, this.organizationService,
this.sendApiService, this.sendApiService,
this.configService,
logoutCallback logoutCallback
); );
this.eventUploadService = new EventUploadService( this.eventUploadService = new EventUploadService(

View File

@@ -443,6 +443,7 @@ export class Main {
this.folderApiService, this.folderApiService,
this.organizationService, this.organizationService,
this.sendApiService, this.sendApiService,
this.configService,
async (expired: boolean) => await this.logout() async (expired: boolean) => await this.logout()
); );

View File

@@ -450,6 +450,7 @@ import { ModalService } from "./modal.service";
FolderApiServiceAbstraction, FolderApiServiceAbstraction,
OrganizationServiceAbstraction, OrganizationServiceAbstraction,
SendApiServiceAbstraction, SendApiServiceAbstraction,
ConfigServiceAbstraction,
LOGOUT_CALLBACK, LOGOUT_CALLBACK,
], ],
}, },

View File

@@ -10,6 +10,7 @@ import { ProviderData } from "../../../admin-console/models/data/provider.data";
import { PolicyResponse } from "../../../admin-console/models/response/policy.response"; import { PolicyResponse } from "../../../admin-console/models/response/policy.response";
import { KeyConnectorService } from "../../../auth/abstractions/key-connector.service"; import { KeyConnectorService } from "../../../auth/abstractions/key-connector.service";
import { ForceSetPasswordReason } from "../../../auth/models/domain/force-set-password-reason"; import { ForceSetPasswordReason } from "../../../auth/models/domain/force-set-password-reason";
import { FeatureFlag } from "../../../enums/feature-flag.enum";
import { DomainsResponse } from "../../../models/response/domains.response"; import { DomainsResponse } from "../../../models/response/domains.response";
import { import {
SyncCipherNotification, SyncCipherNotification,
@@ -17,6 +18,7 @@ import {
SyncSendNotification, SyncSendNotification,
} from "../../../models/response/notification.response"; } from "../../../models/response/notification.response";
import { ProfileResponse } from "../../../models/response/profile.response"; import { ProfileResponse } from "../../../models/response/profile.response";
import { ConfigServiceAbstraction } from "../../../platform/abstractions/config/config.service.abstraction";
import { CryptoService } from "../../../platform/abstractions/crypto.service"; import { CryptoService } from "../../../platform/abstractions/crypto.service";
import { LogService } from "../../../platform/abstractions/log.service"; import { LogService } from "../../../platform/abstractions/log.service";
import { MessagingService } from "../../../platform/abstractions/messaging.service"; import { MessagingService } from "../../../platform/abstractions/messaging.service";
@@ -59,6 +61,7 @@ export class SyncService implements SyncServiceAbstraction {
private folderApiService: FolderApiServiceAbstraction, private folderApiService: FolderApiServiceAbstraction,
private organizationService: InternalOrganizationServiceAbstraction, private organizationService: InternalOrganizationServiceAbstraction,
private sendApiService: SendApiService, private sendApiService: SendApiService,
private configService: ConfigServiceAbstraction,
private logoutCallback: (expired: boolean) => Promise<void> private logoutCallback: (expired: boolean) => Promise<void>
) {} ) {}
@@ -394,6 +397,20 @@ export class SyncService implements SyncServiceAbstraction {
} }
}); });
// If Flexible Collections is enabled, treat Managers as Users and ignore deprecated permissions
if (await this.configService.getFeatureFlag(FeatureFlag.FlexibleCollections)) {
Object.values(organizations).forEach((o) => {
if (o.type === OrganizationUserType.Manager) {
o.type = OrganizationUserType.User;
}
if (o.permissions != null) {
o.permissions.editAssignedCollections = false;
o.permissions.deleteAssignedCollections = false;
}
});
}
await this.organizationService.replace(organizations); await this.organizationService.replace(organizations);
} }