casbin / jcasbin

An authorization library that supports access control models like ACL, RBAC, ABAC in Java
https://casbin.org
Apache License 2.0
2.4k stars 464 forks source link

feat: support AutoSave in built-in FileAdapter #391

Closed imp2002 closed 8 months ago

casbin-bot commented 8 months ago

@tangyang9464 please review

imp2002 commented 8 months ago

Because the previous unit tests defaulted to a File Adapter that didn't implement addPolicy() and removePolicy(), ignoring the impact of autoSave, implementing addPolicy() and removePolicy() now results in inconsistent expect. Therefore, it is necessary to modify the previous tests.

For example: image Following the implementation of File Adapter's addPolicy() method, the policy will change when autoSave is enabled.

hsluoyz commented 8 months ago

@imp2002 you can keep that existing test in AutoSave OFF mode. Then add a new test case which enables AutoSave

codecov-commenter commented 8 months ago

Codecov Report

Attention: Patch coverage is 52.38095% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 69.04%. Comparing base (c56af29) to head (1afb96a).

Files Patch % Lines
...sbin/jcasbin/persist/file_adapter/FileAdapter.java 52.38% 7 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #391 +/- ## ========================================== - Coverage 69.38% 69.04% -0.34% ========================================== Files 53 53 Lines 2401 2420 +19 Branches 423 426 +3 ========================================== + Hits 1666 1671 +5 - Misses 621 634 +13 - Partials 114 115 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 8 months ago

:tada: This PR is included in version 1.54.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: