You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Casbin uses a string array to store all policies, so we have ensured the request is always a string. In some situations, we need additional operations to "parse" request values: casbin/casbin#868.
However, this does bring some benefits, all as strings can greatly reduce the complexity of development. like we can provide a clear signature for the custom function:
Request and policy value is like a read-only tuple. We can use the record Request<T1, T2 ...> type to define them. In order to deal with the different numbers and usage scenarios of policies and requests (the request will be much more than policy), so the request should be lower allocated than the policy instance and try best to avoid boxed-transform.
Context and purposes
Casbin uses a string array to store all policies, so we have ensured the request is always a string. In some situations, we need additional operations to "parse" request values: casbin/casbin#868.
However, this does bring some benefits, all as strings can greatly reduce the complexity of development. like we can provide a clear signature for the custom function:
So this proposal does not completely make the parameters strongly typed, currently only for the following purposes :
Roadmap
Changes:
1. Generic request and policy values
Request and policy value is like a read-only tuple. We can use the
record Request<T1, T2 ...>
type to define them. In order to deal with the different numbers and usage scenarios of policies and requests (the request will be much more than policy), so the request should be lower allocated than the policy instance and try best to avoid boxed-transform.Policy Sample:
Request sample:
2. Expression and matcher
These will help implement a “real matcher”, we do not need the escaping:
Casbin.NET/NetCasbin/Util/StringUtil.cs
Lines 18 to 27 in bb8b51b
Sample test:
The text was updated successfully, but these errors were encountered: