Options
All
  • Public
  • Public/Protected
  • All
Menu

解析权限策略,并提供验证功能

example
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

Hierarchy

  • Policy

Index

Constructors

constructor

Properties

allowActions

allowActions: string[]

denyActions

denyActions: string[]

moduleMap

moduleMap: IModuleAction

Methods

addPolicy

combinationVerify

  • combinationVerify(actionStr: string): boolean
  • 验证组合条件的权限

    Parameters

    • actionStr: string

      需要验证的权限

    Returns boolean

multipleVerify

  • multipleVerify(actions: string | string[]): boolean
  • 验证单个或多个权限

    Parameters

    • actions: string | string[]

    Returns boolean

singleVerify

  • singleVerify(action: string): boolean

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc