casbin / pycasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Python

Home Page:https://casbin.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Performance issue when casbin_rule table has 86k rows

harshrajsinha opened this issue · comments

Hi Everyone,

I am trying to fetch implicit list of resources on which user has permission.

image

tic = time.perf_counter()
permissions = enforcer.get_implicit_permissions_for_user(user_key)
toc = time.perf_counter()
print(f"Implicit List {resource_type_text} fetched in {toc - tic:0.4f} seconds")

for example when user_key = 'USERCLNT0015000001' then implict list of all resources is fetched in more than 2 minutes.

I am using below model :

[request_definition]
r = sub, obj, act

[policy_definition]
p = sub, obj, act

[role_definition]
g = _, _

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act

And I am using MySQL database. I am also attaching the data with this request.
casbin_rule_202308031717.csv

@techoner @Nekotoxin