Skip to content

Commit ed13237

Browse files
Copilothsluoyz
andcommitted
Add JSDoc documentation for useAdapter parameter
Co-authored-by: hsluoyz <3787410+hsluoyz@users.noreply.github.com>
1 parent 5de81ca commit ed13237

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

src/internalEnforcer.ts

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ import { PolicyOp } from './model';
2323
export class InternalEnforcer extends CoreEnforcer {
2424
/**
2525
* addPolicyInternal adds a rule to the current policy.
26+
* @param sec section name
27+
* @param ptype policy type
28+
* @param rule policy rule
29+
* @param useWatcher whether to notify the watcher
30+
* @param useAdapter whether to call the adapter to persist the policy (defaults to true)
2631
*/
2732
protected async addPolicyInternal(sec: string, ptype: string, rule: string[], useWatcher: boolean, useAdapter = true): Promise<boolean> {
2833
if (this.model.hasPolicy(sec, ptype, rule)) {
@@ -58,8 +63,15 @@ export class InternalEnforcer extends CoreEnforcer {
5863
return ok;
5964
}
6065

61-
// addPolicies adds rules to the current policy.
62-
// removePolicies removes rules from the current policy.
66+
/**
67+
* addPolicies adds rules to the current policy.
68+
* removePolicies removes rules from the current policy.
69+
* @param sec section name
70+
* @param ptype policy type
71+
* @param rules policy rules
72+
* @param useWatcher whether to notify the watcher
73+
* @param useAdapter whether to call the adapter to persist the policies (defaults to true)
74+
*/
6375
protected async addPoliciesInternal(
6476
sec: string,
6577
ptype: string,
@@ -107,6 +119,12 @@ export class InternalEnforcer extends CoreEnforcer {
107119

108120
/**
109121
* updatePolicyInternal updates a rule from the current policy.
122+
* @param sec section name
123+
* @param ptype policy type
124+
* @param oldRule old policy rule
125+
* @param newRule new policy rule
126+
* @param useWatcher whether to notify the watcher
127+
* @param useAdapter whether to call the adapter to persist the policy update (defaults to true)
110128
*/
111129
protected async updatePolicyInternal(
112130
sec: string,
@@ -155,6 +173,11 @@ export class InternalEnforcer extends CoreEnforcer {
155173

156174
/**
157175
* removePolicyInternal removes a rule from the current policy.
176+
* @param sec section name
177+
* @param ptype policy type
178+
* @param rule policy rule
179+
* @param useWatcher whether to notify the watcher
180+
* @param useAdapter whether to call the adapter to persist the policy removal (defaults to true)
158181
*/
159182
protected async removePolicyInternal(
160183
sec: string,
@@ -195,7 +218,14 @@ export class InternalEnforcer extends CoreEnforcer {
195218
return ok;
196219
}
197220

198-
// removePolicies removes rules from the current policy.
221+
/**
222+
* removePolicies removes rules from the current policy.
223+
* @param sec section name
224+
* @param ptype policy type
225+
* @param rules policy rules
226+
* @param useWatcher whether to notify the watcher
227+
* @param useAdapter whether to call the adapter to persist the policy removals (defaults to true)
228+
*/
199229
protected async removePoliciesInternal(
200230
sec: string,
201231
ptype: string,
@@ -243,6 +273,12 @@ export class InternalEnforcer extends CoreEnforcer {
243273

244274
/**
245275
* removeFilteredPolicyInternal removes rules based on field filters from the current policy.
276+
* @param sec section name
277+
* @param ptype policy type
278+
* @param fieldIndex field index
279+
* @param fieldValues field values
280+
* @param useWatcher whether to notify the watcher
281+
* @param useAdapter whether to call the adapter to persist the filtered policy removal (defaults to true)
246282
*/
247283
protected async removeFilteredPolicyInternal(
248284
sec: string,

0 commit comments

Comments
 (0)