Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(auth): widen ac to AccessControl for organization() typing

Andreje21c6d43e0f9
diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.ts
index 3bd936466..f0b0558b7 100644
--- a/apps/api/src/auth.ts
+++ b/apps/api/src/auth.ts
@@ -21,6 +21,7 @@ import {
openAPI,
organization,
} from "better-auth/plugins";
+import type { AccessControl } from "better-auth/plugins/access";
import type { UserWithAnonymous } from "better-auth/plugins/anonymous";
import { config } from "dotenv-mono";
import { count, eq, sql } from "drizzle-orm";
@@ -230,7 +231,12 @@ export const auth = betterAuth({
},
}),
organization({
- ac,
+ // `ac` is created with a narrow `statement` shape (project/task/label/
+ // workspace + the default org statements), which makes its inferred
+ // `newRole` generic incompatible with better-auth's looser
+ // `AccessControl` type. Widen via an explicit cast so the plugin
+ // accepts our custom statement.
+ ac: ac as unknown as AccessControl,
roles: { viewer, member, admin, owner },
dynamicAccessControl: {
enabled: true,