PostgreSQL Casbin Adapter
PostgreSQL native adapter for Node-Casbin. With this library, Node-Casbin can load policy from PosgreSQL database or save policy to it. It supports loading filtered policies and is built for improving performances in PostgreSQL. It uses node-postgres to connect to PostgreSQL.
casbin-pg-adapter also adds advanced filtering capability. You can filter using
regexp expressions when using
npm install casbin-pg-adapter
Advanced filtering example
Avoid database migration
Additionnally, you can pass the following option to the Adapter:
migrate(Boolean): If set to
false, the Adapter will not apply migration when starting.
Note: If you use this parameter, you should apply migration manually:
Disabling filtered behavior
If you want to use the
savePolicy feature from
node-casbin, you have to disable the filtered behavior of
You can do it by calling
enableFiltered on the adapter:
This project is under MIT License. See the LICENSE file for the full license text.