mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
merge main, fix conflicts
This commit is contained in:
@@ -113,6 +113,9 @@ export abstract class OrganizationService {
|
||||
* https://bitwarden.atlassian.net/browse/AC-2252.
|
||||
*/
|
||||
getFromState: (id: string) => Promise<Organization>;
|
||||
/**
|
||||
* Emits true if the user can create or manage a Free Bitwarden Families sponsorship.
|
||||
*/
|
||||
canManageSponsorships$: Observable<boolean>;
|
||||
hasOrganizations: () => Promise<boolean>;
|
||||
get$: (id: string) => Observable<Organization | undefined>;
|
||||
|
||||
@@ -183,14 +183,7 @@ export class Organization {
|
||||
return this.isAdmin || this.permissions.editAnyCollection;
|
||||
}
|
||||
|
||||
canEditUnassignedCiphers(restrictProviderAccessFlagEnabled: boolean) {
|
||||
// Providers can access items until the restrictProviderAccess flag is enabled
|
||||
// After the flag is enabled and removed, this block will be deleted
|
||||
// so that they permanently lose access to items
|
||||
if (this.isProviderUser && !restrictProviderAccessFlagEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
get canEditUnassignedCiphers() {
|
||||
return (
|
||||
this.type === OrganizationUserType.Admin ||
|
||||
this.type === OrganizationUserType.Owner ||
|
||||
@@ -198,14 +191,7 @@ export class Organization {
|
||||
);
|
||||
}
|
||||
|
||||
canEditAllCiphers(restrictProviderAccessFlagEnabled: boolean) {
|
||||
// Providers can access items until the restrictProviderAccess flag is enabled
|
||||
// After the flag is enabled and removed, this block will be deleted
|
||||
// so that they permanently lose access to items
|
||||
if (this.isProviderUser && !restrictProviderAccessFlagEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
get canEditAllCiphers() {
|
||||
// The allowAdminAccessToAllCollectionItems flag can restrict admins
|
||||
// Custom users with canEditAnyCollection are not affected by allowAdminAccessToAllCollectionItems flag
|
||||
return (
|
||||
|
||||
@@ -16,5 +16,5 @@ export abstract class AuthService {
|
||||
abstract authStatusFor$(userId: UserId): Observable<AuthenticationStatus>;
|
||||
/** @deprecated use {@link activeAccountStatus$} instead */
|
||||
abstract getAuthStatus: (userId?: string) => Promise<AuthenticationStatus>;
|
||||
abstract logOut: (callback: () => void) => void;
|
||||
abstract logOut: (callback: () => void, userId?: string) => void;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import { EncryptedString } from "../../../../platform/models/domain/enc-string";
|
||||
export class RegisterFinishRequest {
|
||||
constructor(
|
||||
public email: string,
|
||||
public emailVerificationToken: string,
|
||||
|
||||
public masterPasswordHash: string,
|
||||
public masterPasswordHint: string,
|
||||
@@ -18,6 +17,11 @@ export class RegisterFinishRequest {
|
||||
public kdfMemory?: number,
|
||||
public kdfParallelism?: number,
|
||||
|
||||
public emailVerificationToken?: string,
|
||||
public orgSponsoredFreeFamilyPlanToken?: string,
|
||||
public acceptEmergencyAccessInviteToken?: string,
|
||||
public acceptEmergencyAccessId?: string,
|
||||
|
||||
// Org Invite data (only applies on web)
|
||||
public organizationUserId?: string,
|
||||
public orgInviteToken?: string,
|
||||
|
||||
@@ -93,8 +93,8 @@ export class AuthService implements AuthServiceAbstraction {
|
||||
return await firstValueFrom(this.authStatusFor$(userId as UserId));
|
||||
}
|
||||
|
||||
logOut(callback: () => void) {
|
||||
logOut(callback: () => void, userId?: string): void {
|
||||
callback();
|
||||
this.messageSender.send("loggedOut");
|
||||
this.messageSender.send("loggedOut", { userId });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ export enum FeatureFlag {
|
||||
EnableDeleteProvider = "AC-1218-delete-provider",
|
||||
ExtensionRefresh = "extension-refresh",
|
||||
PersistPopupView = "persist-popup-view",
|
||||
RestrictProviderAccess = "restrict-provider-access",
|
||||
PM4154_BulkEncryptionService = "PM-4154-bulk-encryption-service",
|
||||
UseTreeWalkerApiForPageDetailsCollection = "use-tree-walker-api-for-page-details-collection",
|
||||
EmailVerification = "email-verification",
|
||||
@@ -59,7 +58,6 @@ export const DefaultFeatureFlagValue = {
|
||||
[FeatureFlag.EnableDeleteProvider]: FALSE,
|
||||
[FeatureFlag.ExtensionRefresh]: FALSE,
|
||||
[FeatureFlag.PersistPopupView]: FALSE,
|
||||
[FeatureFlag.RestrictProviderAccess]: FALSE,
|
||||
[FeatureFlag.PM4154_BulkEncryptionService]: FALSE,
|
||||
[FeatureFlag.UseTreeWalkerApiForPageDetailsCollection]: FALSE,
|
||||
[FeatureFlag.EmailVerification]: FALSE,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const NoValue = Symbol("NoValue");
|
||||
|
||||
export class Lazy<T> {
|
||||
private _value: T | undefined = undefined;
|
||||
private _isCreated = false;
|
||||
private _value: T | typeof NoValue = NoValue;
|
||||
|
||||
constructor(private readonly factory: () => T) {}
|
||||
|
||||
@@ -10,11 +11,10 @@ export class Lazy<T> {
|
||||
* @returns The value produced by your factory.
|
||||
*/
|
||||
get(): T {
|
||||
if (!this._isCreated) {
|
||||
this._value = this.factory();
|
||||
this._isCreated = true;
|
||||
if (this._value === NoValue) {
|
||||
return (this._value = this.factory());
|
||||
}
|
||||
|
||||
return this._value as T;
|
||||
return this._value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { combineLatest, filter, firstValueFrom, map, switchMap, timeout } from "rxjs";
|
||||
import { combineLatest, concatMap, filter, firstValueFrom, map, timeout } from "rxjs";
|
||||
|
||||
import { LogoutReason } from "@bitwarden/auth/common";
|
||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.service";
|
||||
@@ -79,7 +79,7 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
|
||||
this.accountService.activeAccount$,
|
||||
this.accountService.accountActivity$,
|
||||
]).pipe(
|
||||
switchMap(async ([activeAccount, accountActivity]) => {
|
||||
concatMap(async ([activeAccount, accountActivity]) => {
|
||||
const activeUserId = activeAccount?.id;
|
||||
for (const userIdString in accountActivity) {
|
||||
const userId = userIdString as UserId;
|
||||
|
||||
@@ -77,7 +77,7 @@ export type SingleUserDependency = {
|
||||
export type OnDependency = {
|
||||
/** The stream that controls emissions
|
||||
*/
|
||||
on$: Observable<void>;
|
||||
on$: Observable<any>;
|
||||
};
|
||||
|
||||
/** A pattern for types that emit when a dependency is `true`.
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
import { GenerationRequest } from "../../types";
|
||||
|
||||
/** Options that provide contextual information about the application state
|
||||
* when an integration is invoked.
|
||||
*/
|
||||
export type IntegrationRequest = {
|
||||
/** @param website The domain of the website the requested integration is used
|
||||
* within. This should be set to `null` when the request is not specific
|
||||
* to any website.
|
||||
* @remarks this field contains sensitive data
|
||||
*/
|
||||
website: string | null;
|
||||
};
|
||||
export type IntegrationRequest = Partial<GenerationRequest>;
|
||||
|
||||
@@ -46,3 +46,20 @@ export type Constraints<T> = {
|
||||
|
||||
/** utility type for methods that evaluate constraints generically. */
|
||||
export type AnyConstraint = PrimitiveConstraint & StringConstraints & NumberConstraints;
|
||||
|
||||
/** Options that provide contextual information about the application state
|
||||
* when a generator is invoked.
|
||||
*/
|
||||
export type VaultItemRequest = {
|
||||
/** The domain of the website the requested credential is used
|
||||
* within. This should be set to `null` when the request is not specific
|
||||
* to any website.
|
||||
* @remarks this field contains sensitive data
|
||||
*/
|
||||
website: string | null;
|
||||
};
|
||||
|
||||
/** Options that provide contextual information about the application state
|
||||
* when a generator is invoked.
|
||||
*/
|
||||
export type GenerationRequest = Partial<VaultItemRequest>;
|
||||
|
||||
@@ -5,4 +5,5 @@ export class FolderApiServiceAbstraction {
|
||||
save: (folder: Folder) => Promise<any>;
|
||||
delete: (id: string) => Promise<any>;
|
||||
get: (id: string) => Promise<FolderResponse>;
|
||||
deleteAll: () => Promise<void>;
|
||||
}
|
||||
|
||||
@@ -38,18 +38,14 @@ export class CollectionView implements View, ITreeNodeObject {
|
||||
}
|
||||
}
|
||||
|
||||
canEditItems(org: Organization, restrictProviderAccess: boolean): boolean {
|
||||
canEditItems(org: Organization): boolean {
|
||||
if (org != null && org.id !== this.organizationId) {
|
||||
throw new Error(
|
||||
"Id of the organization provided does not match the org id of the collection.",
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
org?.canEditAllCiphers(restrictProviderAccess) ||
|
||||
this.manage ||
|
||||
(this.assigned && !this.readOnly)
|
||||
);
|
||||
return org?.canEditAllCiphers || this.manage || (this.assigned && !this.readOnly);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,6 +32,11 @@ export class FolderApiService implements FolderApiServiceAbstraction {
|
||||
await this.folderService.delete(id);
|
||||
}
|
||||
|
||||
async deleteAll(): Promise<void> {
|
||||
await this.apiService.send("DELETE", "/folders/all", null, true, false);
|
||||
await this.folderService.clear();
|
||||
}
|
||||
|
||||
async get(id: string): Promise<FolderResponse> {
|
||||
const r = await this.apiService.send("GET", "/folders/" + id, null, true, true);
|
||||
return new FolderResponse(r);
|
||||
|
||||
Reference in New Issue
Block a user