Closed slinders1985 closed 2 years ago
@sagilio @xcaptain @huazhikui
@sagilio @hackerchai
I will add the more load line method to support this, like this: https://github.com/casbin/casbin/pull/887
@sagilio, the tryLoadPolicy pull request that you linked, that should resolve the issue?
@sagilio, the tryLoadPolicy pull request that you linked, that should resolve the issue?
Just wait a moment. also need to update EFCore-Adapter
:tada: This issue has been resolved in version 1.12.1 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Thank you! Works like a charm :ok_hand:
Our model:
The policies are loaded from our db using the EFCore-Adapter. In one of the eval() we want to evaluate a custom function which takes in more than one parameter. The V1 (sub) of the policy will refer to this custom function e.g. customFunction(r.sub, r.dom, "aString").
The custom function gets successfully added to the enforcer, but will never get to the point of execution because of following issue: when the LoadPolicyLine in NetCasbin.Persist.Helper gets hit, the line will split on the commas, which also splits the customFunction(r.sub, r.dom, "aString") into pieces. Therefore in the InternalEnforceWithChainEffector the policyValues.Count will always be larger than the context.PolicyTokens.Count and throw the ArgumentException.
When I adjust the customFunction so it only receives one parameter, the customFunction gets called correctly in the Casbin evaluation process.
Could the Helper be adjusted so that custom functions with multiple parameters are not split any longer on the comma? Are is there another solution to this issue that I can't see at the moment?