mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-10-15 21:31:11 +00:00
fix: resolve cross-tenant access and granular role UI issues for AI settings
This commit is contained in:
@@ -16,7 +16,7 @@ describe("pipeBetweenServers", () => {
|
||||
target: { serverId: null, command: "sleep 0.3; cat > /dev/null" },
|
||||
});
|
||||
expect(bytes).toBe(11);
|
||||
});
|
||||
}, 30_000);
|
||||
|
||||
it("pipes data larger than the pipe buffer unchanged", async () => {
|
||||
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "pipe-"));
|
||||
@@ -47,7 +47,7 @@ describe("pipeBetweenServers", () => {
|
||||
target: { serverId: null, command: "echo boom >&2; exit 3" },
|
||||
}),
|
||||
).rejects.toThrow("target exited with code 3: boom");
|
||||
});
|
||||
}, 30_000);
|
||||
|
||||
it("reports a source failure", async () => {
|
||||
await expect(
|
||||
@@ -56,5 +56,5 @@ describe("pipeBetweenServers", () => {
|
||||
target: { serverId: null, command: "cat > /dev/null" },
|
||||
}),
|
||||
).rejects.toThrow("source exited with code 2");
|
||||
});
|
||||
}, 30_000);
|
||||
});
|
||||
|
||||
@@ -351,7 +351,13 @@ const MENU: Menu = {
|
||||
icon: BotIcon,
|
||||
url: "/dashboard/settings/ai",
|
||||
isSingle: true,
|
||||
isEnabled: ({ permissions }) => !!permissions?.ai.read,
|
||||
isEnabled: ({ permissions }) =>
|
||||
!!(
|
||||
permissions?.ai.read ||
|
||||
permissions?.ai.create ||
|
||||
permissions?.ai.update ||
|
||||
permissions?.ai.delete
|
||||
),
|
||||
},
|
||||
{
|
||||
isSingle: true,
|
||||
|
||||
@@ -193,11 +193,13 @@ export const aiRouter = createTRPCRouter({
|
||||
return await saveAiSettings(ctx.session.activeOrganizationId, input);
|
||||
}),
|
||||
|
||||
getAll: withPermission("ai", "read").query(async ({ ctx }) => {
|
||||
return await getAiSettingsByOrganizationId(
|
||||
ctx.session.activeOrganizationId,
|
||||
);
|
||||
}),
|
||||
getAll: withAnyPermission("ai", ["read", "create", "update", "delete"]).query(
|
||||
async ({ ctx }) => {
|
||||
return await getAiSettingsByOrganizationId(
|
||||
ctx.session.activeOrganizationId,
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
get: withPermission("ai", "read")
|
||||
.input(z.object({ aiId: z.string() }))
|
||||
|
||||
Reference in New Issue
Block a user