Skip to content

Commit c1e6cc1

Browse files
committed
feat: add missing enableLog constructors to enforcers
1 parent 106e18c commit c1e6cc1

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

src/main/java/org/casbin/jcasbin/main/CachedEnforcer.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,18 @@ public CachedEnforcer(String modelPath, Adapter adapter) {
6464
this.cache = new DefaultCache();
6565
}
6666

67+
/**
68+
* Initializes an enforcer with a model file, a database adapter, and a logging flag.
69+
*
70+
* @param modelPath The path of the model file.
71+
* @param adapter The adapter for the database.
72+
* @param enableLog Whether to enable logging for Casbin.
73+
*/
74+
public CachedEnforcer(String modelPath, Adapter adapter, boolean enableLog) {
75+
super(modelPath, adapter, enableLog);
76+
this.cache = new DefaultCache();
77+
}
78+
6779
/**
6880
* Initializes an enforcer with a model and a database adapter.
6981
*
@@ -75,6 +87,18 @@ public CachedEnforcer(Model m, Adapter adapter) {
7587
this.cache = new DefaultCache();
7688
}
7789

90+
/**
91+
* Initializes an enforcer with a model, a database adapter, and a logging flag.
92+
*
93+
* @param m The model.
94+
* @param adapter The adapter for the database.
95+
* @param enableLog Whether to enable logging for Casbin.
96+
*/
97+
public CachedEnforcer(Model m, Adapter adapter, boolean enableLog) {
98+
super(m, adapter, enableLog);
99+
this.cache = new DefaultCache();
100+
}
101+
78102
/**
79103
* Initializes an enforcer with a model.
80104
*

src/main/java/org/casbin/jcasbin/main/DistributedEnforcer.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ public DistributedEnforcer(String modelPath, Adapter adapter) {
5858
super(modelPath, adapter);
5959
}
6060

61+
/**
62+
* DistributedEnforcer initializes an enforcer with a database adapter and an enable log flag.
63+
*
64+
* @param modelPath the path of the model file.
65+
* @param adapter the adapter.
66+
* @param enableLog whether to enable Casbin's log.
67+
*/
68+
public DistributedEnforcer(String modelPath, Adapter adapter, boolean enableLog) {
69+
super(modelPath, adapter, enableLog);
70+
}
71+
6172
/**
6273
* DistributedEnforcer initializes an enforcer with a model and a database adapter.
6374
*
@@ -68,6 +79,17 @@ public DistributedEnforcer(Model m, Adapter adapter) {
6879
super(m, adapter);
6980
}
7081

82+
/**
83+
* DistributedEnforcer initializes an enforcer with a model, a database adapter and an enable log flag.
84+
*
85+
* @param m the model.
86+
* @param adapter the adapter.
87+
* @param enableLog whether to enable Casbin's log.
88+
*/
89+
public DistributedEnforcer(Model m, Adapter adapter, boolean enableLog) {
90+
super(m, adapter, enableLog);
91+
}
92+
7193
/**
7294
* DistributedEnforcer initializes an enforcer with a model.
7395
*

src/main/java/org/casbin/jcasbin/main/SyncedCachedEnforcer.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,18 @@ public SyncedCachedEnforcer(String modelPath, Adapter adapter) {
6161
this.cache = new DefaultCache();
6262
}
6363

64+
/**
65+
* Initializes an enforcer with a model file, a database adapter, and a logging flag.
66+
*
67+
* @param modelPath The path of the model file.
68+
* @param adapter The adapter for the database.
69+
* @param enableLog Whether to enable logging for Casbin.
70+
*/
71+
public SyncedCachedEnforcer(String modelPath, Adapter adapter, boolean enableLog) {
72+
super(modelPath, adapter, enableLog);
73+
this.cache = new DefaultCache();
74+
}
75+
6476
/**
6577
* Initializes an enforcer with a model and a database adapter.
6678
*
@@ -72,6 +84,18 @@ public SyncedCachedEnforcer(Model m, Adapter adapter) {
7284
this.cache = new DefaultCache();
7385
}
7486

87+
/**
88+
* Initializes an enforcer with a model, a database adapter, and a logging flag.
89+
*
90+
* @param m The model.
91+
* @param adapter The adapter for the database.
92+
* @param enableLog Whether to enable logging for Casbin.
93+
*/
94+
public SyncedCachedEnforcer(Model m, Adapter adapter, boolean enableLog) {
95+
super(m, adapter, enableLog);
96+
this.cache = new DefaultCache();
97+
}
98+
7599
/**
76100
* Initializes an enforcer with a model.
77101
*

0 commit comments

Comments
 (0)