Constructors
constructor
-
Parameters
-
-
Optional separator: string
Properties
allowActions
allowActions: string[]
denyActions
denyActions: string[]
Methods
combinationVerify
- combinationVerify(actionStr: string): boolean
-
Parameters
Returns boolean
multipleVerify
- multipleVerify(actions: string | string[]): boolean
-
Parameters
-
actions: string | string[]
Returns boolean
singleVerify
- singleVerify(action: string): boolean
-
Parameters
Returns boolean
解析权限策略,并提供验证功能
const policy = new Policy(); const actions = [ { module: 'module1', action: 'action1' }, { module: 'module1', action: 'action2' }, { module: 'module1', action: 'action3' }, { module: 'module2', action: 'action1' }, { module: 'module2', action: 'action2' } ]; policy.addPolicy({ version: 1, statement: [ { effect: 'allow', action: [ 'module1/*' ] } ] }); policy.singleVerify('module1/action1'); // >> true