@@ -18,7 +18,7 @@ import { Database } from "./database-types";
1818import { abacClient } from "./client" ;
1919import { createAbacAdapter } from "./adapter" ;
2020
21- const abac = ( db : Kysely < Database > ) => {
21+ const abac = ( db : Kysely < Database > , debugLogs : boolean ) => {
2222 const handleUserSetup = async ( userId : string ) => {
2323 if ( ! userId ) return ;
2424
@@ -629,13 +629,17 @@ const abac = (db: Kysely<Database>) => {
629629 } ) ;
630630 }
631631
632- const decision = await canUserPerformAction ( db , {
633- subjectId : subjectId ,
634- resourceId : ctx . body . resourceId ,
635- resourceType : ctx . body . resourceType ,
636- actionName : ctx . body . actionName ,
637- context : ctx . body . context ,
638- } ) ;
632+ const decision = await canUserPerformAction (
633+ db ,
634+ {
635+ subjectId : subjectId ,
636+ resourceId : ctx . body . resourceId ,
637+ resourceType : ctx . body . resourceType ,
638+ actionName : ctx . body . actionName ,
639+ context : ctx . body . context ,
640+ } ,
641+ { debug : debugLogs }
642+ ) ;
639643
640644 return {
641645 decision,
@@ -666,7 +670,8 @@ const abac = (db: Kysely<Database>) => {
666670 db ,
667671 userId ,
668672 ctx . body . resourceId ,
669- ctx . body . context
673+ ctx . body . context ,
674+ { debug : debugLogs }
670675 ) ;
671676 return {
672677 decision,
@@ -697,7 +702,8 @@ const abac = (db: Kysely<Database>) => {
697702 db ,
698703 userId ,
699704 ctx . body . resourceId ,
700- ctx . body . context
705+ ctx . body . context ,
706+ { debug : debugLogs }
701707 ) ;
702708 return {
703709 decision,
@@ -763,7 +769,8 @@ const abac = (db: Kysely<Database>) => {
763769 subjectId ,
764770 actionName ,
765771 resourceIds ,
766- context
772+ context ,
773+ { debug : debugLogs }
767774 ) ;
768775
769776 return {
0 commit comments