casbin / Casbin.NET

An authorization library that supports access control models like ACL, RBAC, ABAC in .NET (C#)
https://casbin.org
Apache License 2.0
1.13k stars 110 forks source link

feat: Support batch enforce and add corresponding test. #274

Closed AsakusaRinne closed 1 year ago

AsakusaRinne commented 1 year ago

Support batch enforce and add corresponding test. #166

It used async stream to implement BatchEnforceAsync except NET452.

It added BatchEnforceParallel in Enforcer without a corresponding interface in IEnforcer. I'm not sure about the design here. What I think is that its only a special implementation so that adding it to IEnforcer may mean little.

As for the extension, I only provide methods which accept generic type inherited from IRequestValues. The reason is that if I provide similar API with that of EnforceExtension.GenericEnforce, users need to pass several IEnumerable, such as e.BatchEnforce(List<T1>, List<T2>, List<T3>). Thus, consistency of the parameters is not actually ensured, which I think may not be a good practice. Please give some suggestions about it.

I'll PR a benchmark of it if the design is approved finally.

casbin-bot commented 1 year ago

@sagilio please review

hsluoyz commented 1 year ago

@AsakusaRinne fix:

image

hsluoyz commented 1 year ago

@AsakusaRinne image

github-actions[bot] commented 1 year ago

:tada: This PR is included in version 2.0.0-preview.5 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 11 months ago

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

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] commented 11 months ago

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

The release is available on GitHub release

Your semantic-release bot :package::rocket: