Skip to content

Commit 3c19732

Browse files
authored
Merge pull request #17 from cnbrown04/role-creation
fix:(debug): debug config option
2 parents 18e74b2 + 0c850fa commit 3c19732

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

src/abac/index.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Database } from "./database-types";
1818
import { abacClient } from "./client";
1919
import { 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

Comments
 (0)