Extract file handling out (as a plugin?) to enable casbin to be used on React Native
See original GitHub issueHey,
firstly thanks for this awesome library!
I noticed that the frontend casbin library uses this under-the-hood, so I’m using this library on both microservice and Frontend.
However, I’d love to be able to use this library on React Native - which would work, but because the model loading from file uses the fs
library, I can’t.
How likely/possible would it be to extract out model loading from a file/file handling to be a plugin/adapter to remove the need for fs
?
(I load the model and policy dynamically from the microservice).
Thanks!
Issue Analytics
- State:
- Created 2 years ago
- Comments:29 (22 by maintainers)
Top Results From Across the Web
Access Control in Node.js with Fastify and Casbin - NearForm
Casbin offers a great foundation for access control, and Fastify's plugin system is perfect for abstracting away some of its complexity.
Read more >How to allow react-native to enable support for JSX (extension ...
I have to use it to enable JSX support instead of rn-cli.config.js . Check out the documentation for the config file: ...
Read more >Casbin · An authorization library that supports access control ...
An authorization library that supports access control models like ACL, RBAC, ABAC for Golang, Java, C/C++, Node.js, Javascript, PHP, Laravel, Python, .
Read more >Ecosystem - Fastify
@fastify/cors, Enables the use of CORS in a Fastify application. ... process load with automatic handling of "Service Unavailable" plugin for Fastify.
Read more >Extensions - Keycloak
Utility to ensure the desired configuration state for a realm based on a JSON or YAML file. Discord Identity Provider. Keycloak extension to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hsluoyz I agreed with @Sefriol and @harveyappleton idea.
The following is my integration steps:
node-casbin
project, we doesn’t need to export this inindex.ts
,node-casbin
only uses string/memory adapter/model for cross-platform compatible.ip
package fromnode-casbin
, this package usesos
module, we can rewrite this package: #266globMatch
depends on themicromatch
package,micromatch
usesutil
provided by Node.js , so we need to consider to useminimatch
instead ofmicromatch
: #264rn-nodeify
looks really scary. I would rather keepfs
as is than use it.Same could be said for not doing the change: users won’t use Casbin since it does not work on their platform. Adapters are already in use and I do not see file adapter any more special than any other adapter.
In my opinion, since
string
/ in memory adapter is usable between all platforms, it should be the default one and file adapter should be a plugin like the rest of them.So pretty much two options:
node-casbin
and add it shall be a plugin. Plugin is added into devDependancies for the tests.