Skip to content

logger print exception #327

Open
Open
@FriedRice-Mao

Description

@FriedRice-Mao

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/casbin/lib/cjs/coreEnforcer.js b/node_modules/casbin/lib/cjs/coreEnforcer.js
index b9e4f06..9e9ff26 100644
--- a/node_modules/casbin/lib/cjs/coreEnforcer.js
+++ b/node_modules/casbin/lib/cjs/coreEnforcer.js
@@ -158,6 +158,7 @@ class CoreEnforcer {
     async loadPolicy() {
         this.model.clearPolicy();
         await this.adapter.loadPolicy(this.model);
+        this.model.printPolicy();
         this.sortPolicies();
         if (this.autoBuildRoleLinks) {
             await this.buildRoleLinksInternal();
diff --git a/node_modules/casbin/lib/cjs/rbac/defaultRoleManager.js b/node_modules/casbin/lib/cjs/rbac/defaultRoleManager.js
index 1db1411..c3a25db 100644
--- a/node_modules/casbin/lib/cjs/rbac/defaultRoleManager.js
+++ b/node_modules/casbin/lib/cjs/rbac/defaultRoleManager.js
@@ -285,8 +285,10 @@ class DefaultRoleManager {
      */
     async printRoles() {
         if (log_1.getLogger().isEnable()) {
-            [...this.allDomains.values()].forEach((n) => {
-                log_1.logPrint(n.toString());
+            [...this.allDomains.values()].forEach((roles) => {
+                roles.forEach(n => { 
+                    log_1.logPrint(n.toString());
+                });
             });
         }
     }

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions