0

Hi I want to check for roles single or multiple in the matcher for my restful apis endpoint, I am getting roles as list of strings, I want to enfore casbin permission for the endpoints. How do I create custom function in python, I am not getting any detail for python here (https://casbin.org/docs/en/function) I am using pycasbin.

my auth_policy:

p, custom_role, endpoint, GET

in my authz_model.conf, I want to add my custom_func(p.role,r.role) instead of checking p.role==r.role

ratnesh
  • 436
  • 1
  • 5
  • 16

1 Answers1

1

Please use add_function(), see: https://github.com/casbin/pycasbin/issues/215

Here's an example: https://github.com/casbin/pycasbin/pull/217

hsluoyz
  • 2,739
  • 5
  • 35
  • 59