Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions packages/cloud/src/WebAuthService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -563,11 +563,7 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
)?.email_address
}

// Check for extension_bridge_enabled in user's public metadata
let extensionBridgeEnabled = false
if (userData.public_metadata?.extension_bridge_enabled === true) {
extensionBridgeEnabled = true
}
let extensionBridgeEnabled = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Business logic change: For personal users, extensionBridgeEnabled is now always set to true. Please add a clarifying comment explaining that personal accounts always have the extension bridge enabled and that the user metadata flag is no longer used.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this intentional as a breaking change? The default changing from to could affect existing users who haven't explicitly set this flag. Should there be a migration strategy or announcement for this change?


// Fetch organization info if user is in organization context
try {
Expand All @@ -583,11 +579,7 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
if (userMembership) {
this.setUserOrganizationInfo(userInfo, userMembership)

// Check organization public metadata for extension_bridge_enabled
// Organization setting takes precedence over user setting
if (await this.isExtensionBridgeEnabledForOrganization(storedOrgId)) {
extensionBridgeEnabled = true
}
extensionBridgeEnabled = await this.isExtensionBridgeEnabledForOrganization(storedOrgId)

this.log("[auth] User in organization context:", {
id: userMembership.organization.id,
Expand All @@ -608,10 +600,9 @@ export class WebAuthService extends EventEmitter<AuthServiceEvents> implements A
if (primaryOrgMembership) {
this.setUserOrganizationInfo(userInfo, primaryOrgMembership)

// Check organization public metadata for extension_bridge_enabled
if (await this.isExtensionBridgeEnabledForOrganization(primaryOrgMembership.organization.id)) {
extensionBridgeEnabled = true
}
extensionBridgeEnabled = await this.isExtensionBridgeEnabledForOrganization(
primaryOrgMembership.organization.id,
)

this.log("[auth] Legacy credentials: Found organization membership:", {
id: primaryOrgMembership.organization.id,
Expand Down
8 changes: 4 additions & 4 deletions packages/cloud/src/__tests__/WebAuthService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ describe("WebAuthService", () => {
name: "John Doe",
email: "john@example.com",
picture: "https://example.com/avatar.jpg",
extensionBridgeEnabled: false,
extensionBridgeEnabled: true,
},
})
})
Expand Down Expand Up @@ -725,7 +725,7 @@ describe("WebAuthService", () => {
name: "Jane Smith",
email: "jane@example.com",
picture: "https://example.com/jane.jpg",
extensionBridgeEnabled: false,
extensionBridgeEnabled: true,
})
})

Expand Down Expand Up @@ -844,7 +844,7 @@ describe("WebAuthService", () => {
name: "John Doe",
email: undefined,
picture: undefined,
extensionBridgeEnabled: false,
extensionBridgeEnabled: true,
})
})
})
Expand Down Expand Up @@ -969,7 +969,7 @@ describe("WebAuthService", () => {
name: "Test User",
email: undefined,
picture: undefined,
extensionBridgeEnabled: false,
extensionBridgeEnabled: true,
},
})
})
Expand Down
Loading