mirror of
https://github.com/bitwarden/browser
synced 2025-12-14 23:33:31 +00:00
[PM-13374] Update all SDK uuids (#14962)
* fix: broken SDK interface * Fix all compile errors related to uuids * Fix browser desktop * Fix tests --------- Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
import { Component, Input } from "@angular/core";
|
||||
|
||||
import { CollectionView } from "@bitwarden/admin-console/common";
|
||||
import { uuidAsString } from "@bitwarden/common/platform/abstractions/sdk/sdk.service";
|
||||
import { CollectionId } from "@bitwarden/sdk-internal";
|
||||
|
||||
import { SharedModule } from "../../../../shared/shared.module";
|
||||
import { GetCollectionNameFromIdPipe } from "../pipes";
|
||||
@@ -13,11 +15,11 @@ import { GetCollectionNameFromIdPipe } from "../pipes";
|
||||
imports: [SharedModule, GetCollectionNameFromIdPipe],
|
||||
})
|
||||
export class CollectionNameBadgeComponent {
|
||||
@Input() collectionIds: string[];
|
||||
@Input() collectionIds: CollectionId[] | string[];
|
||||
@Input() collections: CollectionView[];
|
||||
|
||||
get shownCollections(): string[] {
|
||||
return this.showXMore ? this.collectionIds.slice(0, 2) : this.collectionIds;
|
||||
return (this.showXMore ? this.collectionIds.slice(0, 2) : this.collectionIds).map(uuidAsString);
|
||||
}
|
||||
|
||||
get showXMore(): boolean {
|
||||
|
||||
@@ -310,7 +310,7 @@ export class VaultItemsComponent<C extends CipherViewLike> {
|
||||
const orgCollections = this.allCollections.filter((c) => c.organizationId === org.id);
|
||||
|
||||
for (const collection of orgCollections) {
|
||||
if (vaultItem.cipher.collectionIds.includes(collection.id) && collection.manage) {
|
||||
if (vaultItem.cipher.collectionIds.includes(collection.id as any) && collection.manage) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ export class VaultItemsComponent<C extends CipherViewLike> {
|
||||
}
|
||||
|
||||
return this.allCollections
|
||||
.filter((c) => cipher.collectionIds.includes(c.id))
|
||||
.filter((c) => cipher.collectionIds.includes(c.id as any))
|
||||
.some((collection) => collection.manage);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { AvatarService } from "@bitwarden/common/auth/abstractions/avatar.servic
|
||||
import { TokenService } from "@bitwarden/common/auth/abstractions/token.service";
|
||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
import { OrganizationId } from "@bitwarden/sdk-internal";
|
||||
|
||||
@Component({
|
||||
selector: "app-org-badge",
|
||||
@@ -15,7 +16,7 @@ import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
standalone: false,
|
||||
})
|
||||
export class OrganizationNameBadgeComponent implements OnChanges {
|
||||
@Input() organizationId?: string;
|
||||
@Input() organizationId?: OrganizationId | string;
|
||||
@Input() organizationName: string;
|
||||
@Input() disabled: boolean;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Pipe, PipeTransform } from "@angular/core";
|
||||
|
||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||
import { OrganizationId } from "@bitwarden/sdk-internal";
|
||||
|
||||
@Pipe({
|
||||
name: "orgNameFromId",
|
||||
@@ -8,7 +9,7 @@ import { Organization } from "@bitwarden/common/admin-console/models/domain/orga
|
||||
standalone: false,
|
||||
})
|
||||
export class GetOrgNameFromIdPipe implements PipeTransform {
|
||||
transform(value: string, organizations: Organization[]) {
|
||||
transform(value: string | OrganizationId, organizations: Organization[]) {
|
||||
const orgName = organizations?.find((o) => o.id === value)?.name;
|
||||
return orgName;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ export function createFilterFunction(filter: RoutedVaultFilterModel): FilterFunc
|
||||
filter.collectionId !== undefined &&
|
||||
filter.collectionId !== All &&
|
||||
filter.collectionId !== Unassigned &&
|
||||
(cipher.collectionIds == null || !cipher.collectionIds.includes(filter.collectionId))
|
||||
(cipher.collectionIds == null || !cipher.collectionIds.includes(filter.collectionId as any))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.servic
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||
import { uuidAsString } from "@bitwarden/common/platform/abstractions/sdk/sdk.service";
|
||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||
import { SyncService } from "@bitwarden/common/platform/sync";
|
||||
import { CipherId, CollectionId, OrganizationId, UserId } from "@bitwarden/common/types/guid";
|
||||
@@ -678,7 +679,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
return;
|
||||
} else if (cipher.organizationId != null) {
|
||||
const org = await firstValueFrom(
|
||||
this.organizations$.pipe(getOrganizationById(cipher.organizationId)),
|
||||
this.organizations$.pipe(getOrganizationById(uuidAsString(cipher.organizationId))),
|
||||
);
|
||||
if (org != null && (org.maxStorageGb == null || org.maxStorageGb === 0)) {
|
||||
this.messagingService.send("upgradeOrganization", {
|
||||
@@ -775,7 +776,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
}
|
||||
|
||||
async editCipher(cipher: CipherView | CipherListView, cloneMode?: boolean) {
|
||||
return this.editCipherId(cipher?.id, cloneMode);
|
||||
return this.editCipherId(uuidAsString(cipher?.id), cloneMode);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1044,7 +1045,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
|
||||
try {
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
await this.cipherService.restoreWithServer(c.id, activeUserId);
|
||||
await this.cipherService.restoreWithServer(uuidAsString(c.id), activeUserId);
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
@@ -1066,7 +1067,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedCipherIds = ciphers.map((cipher) => cipher.id);
|
||||
const selectedCipherIds = ciphers.map((cipher) => uuidAsString(cipher.id));
|
||||
if (selectedCipherIds.length === 0) {
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
@@ -1128,7 +1129,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
|
||||
try {
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
await this.deleteCipherWithServer(c.id, activeUserId, permanent);
|
||||
await this.deleteCipherWithServer(uuidAsString(c.id), activeUserId, permanent);
|
||||
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
@@ -1168,7 +1169,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
const dialog = openBulkDeleteDialog(this.dialogService, {
|
||||
data: {
|
||||
permanent: this.filter.type === "trash",
|
||||
cipherIds: ciphers.map((c) => c.id),
|
||||
cipherIds: ciphers.map((c) => uuidAsString(c.id)),
|
||||
organizations: organizations,
|
||||
collections: collections,
|
||||
},
|
||||
@@ -1185,7 +1186,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
return;
|
||||
}
|
||||
|
||||
const selectedCipherIds = ciphers.map((cipher) => cipher.id);
|
||||
const selectedCipherIds = ciphers.map((cipher) => uuidAsString(cipher.id));
|
||||
if (selectedCipherIds.length === 0) {
|
||||
this.toastService.showToast({
|
||||
variant: "error",
|
||||
@@ -1261,11 +1262,14 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
});
|
||||
|
||||
if (field === "password") {
|
||||
await this.eventCollectionService.collect(EventType.Cipher_ClientCopiedPassword, cipher.id);
|
||||
await this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientCopiedPassword,
|
||||
uuidAsString(cipher.id),
|
||||
);
|
||||
} else if (field === "totp") {
|
||||
await this.eventCollectionService.collect(
|
||||
EventType.Cipher_ClientCopiedHiddenField,
|
||||
cipher.id,
|
||||
uuidAsString(cipher.id),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1324,7 +1328,7 @@ export class VaultComponent<C extends CipherViewLike> implements OnInit, OnDestr
|
||||
}
|
||||
|
||||
const activeUserId = await firstValueFrom(this.accountService.activeAccount$.pipe(getUserId));
|
||||
const _cipher = await this.cipherService.get(cipher.id, activeUserId);
|
||||
const _cipher = await this.cipherService.get(uuidAsString(cipher.id), activeUserId);
|
||||
const cipherView = await this.cipherService.decrypt(_cipher, activeUserId);
|
||||
return cipherView.login?.password;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user