Closed dovranJorayev closed 11 months ago
@nodece @Shivansh-yadav13
@dovranJorayev see docs: https://casbin.org/docs/frontend/
@dovranJorayev see docs: https://casbin.org/docs/frontend/
I know if i will use manual option it will be not such case. But i am interested in that use-case
// Set your backend Casbin service URL
const authorizer = new casbinjs.Authorizer(
'auto', // mode
{endpoint: 'http://your_endpoint/api/casbin'}
);
const result = authorizer.can("read", "data1"); // <------ Promise here
I don't get how it will process. Does all authorizer.can(...) calls will comunicate with backend or it load all permissions once event in such mode. Or it has something like caching?
@dovranJorayev IIRC, it only loads policy from remote once, it doesn't call RESTful API for each .can() method. For details, you need to see the source code
@dovranJorayev IIRC, it only loads policy from remote once, it doesn't call RESTful API for each .can() method. For details, you need to see the source code
Thanks a lot @hsluoyz , this point was unclear for me until now
Help me please to understand how casbin.js client side library will behave if access related data will be live on backend side... Do all
authorizer.can("read", "data1")
calls will make request for a server or it is somehow caching the data or load all data related to app on initialization step? Because i guess it would decrease UX if every time will knock backend when need to interact with interface