yes that was my thinking too, which is why I thought that in this case it is fine to access the enforcer in a multithreaded context if you are only using it to enforce policies which are not changing
right but from my understanding enforce is a read only operation so if I can get rid of the overhead of calling synchronised code I would prefer to do that to improve performance
No I mean I have a single shared enforcer (let's assume that the policies have been loaded in a synchronised manner). Currently I use SyncedEnforcer however the only method I call on this enforcer is enforce. Can I switch to using Enforcer without introducing race conditions into my code?
Is using SyncedEnforcer necessary if you are accessing the same enforcer using multiple threads but only to call enforce as opposed to any of the methods which modify policies?
Why does Casbin.js exist if in the description of node-casbin it states that it can run on node.js and the browser?
nevermind, just found it in the docs: https://casbin.org/docs/frontend/#why-casbinjs
When using the ABAC model in jCasbin, is there any concise alternative to creating a new class for each 'object' you want to pass in to the enforce method?
For anyone who might come across this in the future, it must be a java bean for its attributes to be accessed correctly in any expression evaluated using eval based on a mix of my testing and GPT4. Hence if you want to access an attribute called balance, the class must have a public getter method called getBalance.
I mean specifically the evaluation of expressions that are stored in policies e.g. p, policyName, 1 == 1 using the eval function described here: https://casbin.org/docs/abac/#scaling-the-model-for-complex-and-large-numbers-of-abac-rules
For example, the === operator seems to be supported in Node-Casbin due to the use of expression-eval for expression evaluation but not in jCasbin
From my understanding the model syntax is standardised between different distributions of casbin but the expression syntax is not due to the use of different expressions evaluators on different platforms (e.g. aviatorscript on jCasbin and expression-eval on Node-Casbin), is this correct?
sure give me one second
my question is specific to the java version of casbin, JCasbin
with NodeCasbin this process is pretty straightforward
I am using JCasbin with the ABAC model. Suppose I have a policy authTransaction, r.user.balance > 1000, I now need to pass in a user object into the enforce method to determine if a user can perform a transaction. I want to know what structure the user object that is being passed into enforce should have, should it just be a regular java object with a single public attribute balance?
My matcher uses the eval function to evaluate the policy rule
I've read the doc but it doesn't specify the structure of the class you should pass in, specifically for JCasbin, it simply mentions: Pass in the struct or class instance for the element as an argument to Casbin's Enforce() function.
I'm using JCasbin with the ABAC model. What structure should an object that's being passed into the enforce method have? Let's say my policy rule is sub.balance > 1000, does that mean the object that I pass in must have a public attribute balance?

