Skip to content

Commit f08c0a4

Browse files
committed
style: style problem
1 parent 2aeafea commit f08c0a4

2 files changed

Lines changed: 32 additions & 8 deletions

File tree

src/internalEnforcer.ts

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class InternalEnforcer extends CoreEnforcer {
2424
/**
2525
* addPolicyInternal adds a rule to the current policy.
2626
*/
27-
protected async addPolicyInternal(sec: string, ptype: string, rule: string[], useWatcher: boolean, useAdapter: boolean = true): Promise<boolean> {
27+
protected async addPolicyInternal(sec: string, ptype: string, rule: string[], useWatcher: boolean, useAdapter = true): Promise<boolean> {
2828
if (this.model.hasPolicy(sec, ptype, rule)) {
2929
return false;
3030
}
@@ -61,7 +61,13 @@ export class InternalEnforcer extends CoreEnforcer {
6161

6262
// addPolicies adds rules to the current policy.
6363
// removePolicies removes rules from the current policy.
64-
protected async addPoliciesInternal(sec: string, ptype: string, rules: string[][], useWatcher: boolean, useAdapter: boolean = true): Promise<boolean> {
64+
protected async addPoliciesInternal(
65+
sec: string,
66+
ptype: string,
67+
rules: string[][],
68+
useWatcher: boolean,
69+
useAdapter = true
70+
): Promise<boolean> {
6571
for (const rule of rules) {
6672
if (this.model.hasPolicy(sec, ptype, rule)) {
6773
return false;
@@ -106,7 +112,13 @@ export class InternalEnforcer extends CoreEnforcer {
106112
* Unlike addPoliciesInternal, this method will filter out rules that already exist
107113
* and continue to add the remaining rules instead of returning false immediately.
108114
*/
109-
protected async addPoliciesInternalEx(sec: string, ptype: string, rules: string[][], useWatcher: boolean, useAdapter: boolean = true): Promise<boolean> {
115+
protected async addPoliciesInternalEx(
116+
sec: string,
117+
ptype: string,
118+
rules: string[][],
119+
useWatcher: boolean,
120+
useAdapter = true
121+
): Promise<boolean> {
110122
// Filter out existing rules
111123
const newRules = rules.filter((rule) => !this.model.hasPolicy(sec, ptype, rule));
112124

@@ -157,7 +169,7 @@ export class InternalEnforcer extends CoreEnforcer {
157169
oldRule: string[],
158170
newRule: string[],
159171
useWatcher: boolean,
160-
useAdapter: boolean = true
172+
useAdapter = true
161173
): Promise<boolean> {
162174
if (!this.model.hasPolicy(sec, ptype, oldRule)) {
163175
return false;
@@ -199,7 +211,13 @@ export class InternalEnforcer extends CoreEnforcer {
199211
/**
200212
* removePolicyInternal removes a rule from the current policy.
201213
*/
202-
protected async removePolicyInternal(sec: string, ptype: string, rule: string[], useWatcher: boolean, useAdapter: boolean = true): Promise<boolean> {
214+
protected async removePolicyInternal(
215+
sec: string,
216+
ptype: string,
217+
rule: string[],
218+
useWatcher: boolean,
219+
useAdapter = true
220+
): Promise<boolean> {
203221
if (!this.model.hasPolicy(sec, ptype, rule)) {
204222
return false;
205223
}
@@ -234,7 +252,13 @@ export class InternalEnforcer extends CoreEnforcer {
234252
}
235253

236254
// removePolicies removes rules from the current policy.
237-
protected async removePoliciesInternal(sec: string, ptype: string, rules: string[][], useWatcher: boolean, useAdapter: boolean = true): Promise<boolean> {
255+
protected async removePoliciesInternal(
256+
sec: string,
257+
ptype: string,
258+
rules: string[][],
259+
useWatcher: boolean,
260+
useAdapter = true
261+
): Promise<boolean> {
238262
for (const rule of rules) {
239263
if (!this.model.hasPolicy(sec, ptype, rule)) {
240264
return false;
@@ -283,7 +307,7 @@ export class InternalEnforcer extends CoreEnforcer {
283307
fieldIndex: number,
284308
fieldValues: string[],
285309
useWatcher: boolean,
286-
useAdapter: boolean = true
310+
useAdapter = true
287311
): Promise<boolean> {
288312
// if (this.adapter && this.autoSave) {
289313
if (useAdapter && this.adapter && this.autoSave) {

src/managementEnforcer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ export class ManagementEnforcer extends InternalEnforcer {
589589
public async addFunction(name: string, func: MatchingFunction): Promise<void> {
590590
this.fm.addFunction(name, func);
591591
}
592-
// add fifth argument
592+
// add fifth argument
593593
public async selfAddPolicy(sec: string, ptype: string, rule: string[]): Promise<boolean> {
594594
return this.addPolicyInternal(sec, ptype, rule, false, false);
595595
}

0 commit comments

Comments
 (0)