Skip to content

NewbMiao/dynacasbin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dynacasbin

Dynacasbin is the DynamoDB adapter for Casbin. With this library, Casbin can load policy from DynamoDB and auto save during add/remove policy.

code is inspired by github.com/hooqtv/dynacasbin, and autoSave support for it.

Installation

go get github.com/newbmiao/dynacasbin

Simple Example

see more detail in examples

Notes

  • No need use LoadPolicy and SavePolicy.

    Auto save is supported now. SavePolicy is overwrite by just batch putItems without recreate table and adapter.loadPolicy after. Cause dynamodb recreate table has latency, and adapter.loadPolicy is repeat not reload when call it multi times. which is unreliable.

  • About policy unique

    ID is hash key which value is unique by use md5(policy)

  • About RemoveFilteredPolicy

    RemoveFilteredPolicy is implement by getAllItems and then filter items to delete. This may has latency when data is so big. Use as appropriate.

Getting Help

Other Choice

Wana some other choice?

There is a flexible and powerful open policy engine, named OPA, you can refer to opa-koans and get start from there.