Skip to content

Commit

Permalink
[Vaults] Fix: private vaults unusable: feature flags not in auth (#7893)
Browse files Browse the repository at this point in the history
Description
---
Fixes dust-tt/tasks#1415

Issue was broader than just websites: permission checks were always
false on private vaults datasources for assistant retrieval

This was due to a test on the private vault feature flag, while the
auth instance used to check permissions, using fromRegistry, had no
flag sets

Risk
---
na

Deploy
---
front
  • Loading branch information
philipperolet authored Oct 4, 2024
1 parent 6de867a commit 349e351
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions front/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,6 @@ export class Authenticator {
const getSubscriptionForWorkspace = (workspace: Workspace) =>
subscriptionForWorkspace(renderLightWorkspaceType({ workspace }));

const getFeatureFlags = async (workspace: Workspace) =>
(await FeatureFlag.findAll({ where: { workspaceId: workspace.id } })).map(
(flag) => flag.name
);

let keyGroups: GroupResource[] = [];
let requestedGroups: GroupResource[] = [];
let keyFlags: WhitelistableFeature[] = [];
Expand Down Expand Up @@ -447,7 +442,7 @@ export class Authenticator {
);

return new Authenticator({
flags: [],
flags: await getFeatureFlags(workspace),
groups,
role: "builder",
subscription: null,
Expand Down Expand Up @@ -902,3 +897,8 @@ export async function prodAPICredentialsForOwner(
workspaceId: owner.sId,
};
}

const getFeatureFlags = async (workspace: Workspace) =>
(await FeatureFlag.findAll({ where: { workspaceId: workspace.id } })).map(
(flag) => flag.name
);

0 comments on commit 349e351

Please sign in to comment.