sequelize-adapter icon indicating copy to clipboard operation
sequelize-adapter copied to clipboard

feat: Filtered policy support

Open rogersgt opened this issue 2 years ago • 2 comments

Support for Filtered Policy

Why?

In certain implementations, the casbin rule data store gets quite large for ABAC in an enterprise solution. I would love to be able to use the sequelize adapter with filtered policies in order to load policies by client domains, for example.

What this should do

  • Added one new method called loadFilteredPolicy according to the casbin adapter documentation
  • Added a test for loading a filtered policy
  • Added "es6": true to the .eslintrc to support await Promise.all(). Although I'm happy to revise this to use the syntax of choice.
  • Moved an await statement in testGetPolicy so that you can actually read the policy in the logs during testing: before: Screen Shot 2022-05-25 at 2 24 09 PM after: Screen Shot 2022-05-25 at 2 24 53 PM

How to test

yarn test: Screen Shot 2022-05-25 at 2 19 39 PM

rogersgt avatar May 25 '22 18:05 rogersgt

@Gabriel-403 @Zxilly @kingiw @nodece please review

casbin-bot avatar May 25 '22 18:05 casbin-bot

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar May 25 '22 18:05 CLAassistant

@kingiw @nodece or @Gabriel-403 any thoughts about this?

rogersgt avatar Sep 10 '22 13:09 rogersgt

lgtm

hsluoyz avatar Sep 11 '22 02:09 hsluoyz

@rogersgt can you fix the issue caused by this PR? https://github.com/node-casbin/sequelize-adapter/issues/65

hsluoyz avatar Sep 11 '22 02:09 hsluoyz

could it be because of setiing "es6": true?

Shivansh-yadav13 avatar Sep 21 '22 12:09 Shivansh-yadav13

:tada: This PR is included in version 2.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Sep 22 '22 12:09 github-actions[bot]