You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@casbin.apache.org by "vlieven (via GitHub)" <gi...@apache.org> on 2026/09/24 08:31:32 UTC

[PR] fix: skip pattern matching in delete_link when no matching func is set [casbin-pycasbin]

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: commits-unsubscribe@casbin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org


Re: [PR] fix: skip pattern matching in delete_link when no matching func is set [casbin-pycasbin]

Posted by "coveralls (via GitHub)" <gi...@apache.org>.
coveralls commented on PR #436:
URL: https://github.com/apache/casbin-pycasbin/pull/436#issuecomment-5817119787

   ## Coverage Report for [CI Build 35975753290](https://coveralls.io/builds/81946546)
   
   > [!WARNING]
   > **Build has drifted**: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
   > Quick fix: [rebase this PR](https://github.blog/changelog/2022-02-03-more-ways-to-keep-your-pull-request-branch-up-to-date/#update-your-pull-request-branch-by-rebasing). [Learn more →](https://docs.coveralls.io/build-types#tracking-coverage-changes-with-pull_request-builds)
   
   ### Coverage decreased (**-0.05%**) to **84.172%**
   
   ### Details
   - Coverage decreased (-0.05%) from the [base build](https://coveralls.io/builds/81914146).
   - **Patch coverage**: **1 uncovered change** across **1** file (**9** of **10** lines covered, 90.0%).
   - **2 coverage regressions** across **1** file.
   
   ### Uncovered Changes
   
   | File | Changed | Covered | % |
   | :--- | ------: | ------: | ---: |
   | [casbin/rbac/default_role_manager/role_manager.py](https://coveralls.io/builds/81946546/source?filename=casbin%2Frbac%2Fdefault_role_manager%2Frole_manager.py#L182) | 10 | 9 | 90.0% |
   
   ### Coverage Regressions
   **2** previously-covered lines in **1** file lost coverage.
   
   | File | Lines Losing Coverage | Coverage |
   | :--- | ---------: | -------: |
   | [casbin/rbac/default_role_manager/role_manager.py](https://coveralls.io/builds/81946546/source?filename=casbin%2Frbac%2Fdefault_role_manager%2Frole_manager.py#L369) | 2 | 91.97% |
   
   ---
   
   ### Coverage Stats
   
   |  | [![Coverage Status](https://coveralls.io/builds/81946546/badge)](https://coveralls.io/builds/81946546) |
   | :-- | --: |
   | Relevant Lines: | 3955 |
   | Covered Lines: | 3329 |
   | Line Coverage: | 84.17% |
   | Coverage Strength: | 5.05 hits per line |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


-- 
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: commits-unsubscribe@casbin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org


Re: [PR] fix: skip pattern matching in delete_link when no matching func is set [casbin-pycasbin]

Posted by "hsluoyz (via GitHub)" <gi...@apache.org>.
hsluoyz commented on PR #436:
URL: https://github.com/apache/casbin-pycasbin/pull/436#issuecomment-5816616402

   replaced by: https://github.com/apache/casbin-pycasbin/commit/b7c36d90dcd72fafd8cb0388d340f1788faf62d1


-- 
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: commits-unsubscribe@casbin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org


Re: [PR] fix: skip pattern matching in delete_link when no matching func is set [casbin-pycasbin]

Posted by "hsluoyz (via GitHub)" <gi...@apache.org>.
hsluoyz closed pull request #436: fix: skip pattern matching in delete_link when no matching func is set
URL: https://github.com/apache/casbin-pycasbin/pull/436


-- 
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: commits-unsubscribe@casbin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@casbin.apache.org
For additional commands, e-mail: commits-help@casbin.apache.org