Custom function in casbin matcher in pycasbin for restful apis

570 Views Asked by At

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

1

There are 1 best solutions below

0
hsluoyz On BEST ANSWER