vlieven opened a new pull request, #436:
URL: https://github.com/apache/casbin-pycasbin/pull/436

   `RoleManager.add_link` only walks `all_roles` to apply pattern-derived links 
when a matching function is set, but `delete_link` walked it unconditionally. 
With `matching_func = None`, every iteration called `match_error_handler(None, 
...)`, which raised and swallowed a TypeError, so the result was correct but 
each delete was O(roles) wasted work.
   
   The cost multiplies with a domain matching function on g (e.g. `g, user, 
group, *` with `key_match`), because `DomainManager` forwards the delete to 
every cached domain's role manager.
   
   Guard the loop with the same check add_link uses. `ConditionalRoleManager`, 
`DomainManager` and `ConditionalDomainManager` all delegate to this method, so 
they are covered too.
   Add tests that check `delete_link` behavior without a matching function, 
both on its own and across cached domains.
   Also correct `!= None` to `is not None` 
[(PEP8)](https://peps.python.org/pep-0008/#programming-recommendations)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to