Gathering detailed insights and metrics for @elastic.io/casbin-mongoose-adapter
Gathering detailed insights and metrics for @elastic.io/casbin-mongoose-adapter
Gathering detailed insights and metrics for @elastic.io/casbin-mongoose-adapter
Gathering detailed insights and metrics for @elastic.io/casbin-mongoose-adapter
Mongoose adapter for Casbin
npm install @elastic.io/casbin-mongoose-adapter
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
15 Stars
19 Commits
3 Forks
9 Watchers
10 Branches
9 Contributors
Updated on Mar 13, 2021
Latest Version
1.0.0
Package Id
@elastic.io/casbin-mongoose-adapter@1.0.0
Unpacked Size
37.40 kB
Size
9.64 kB
File Count
17
NPM Version
6.5.0
Node Version
11.6.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
MongoDB policy storage, implemented as an adapter for node-casbin.
Install the package as dependency in your project:
1npm install --save @elastic.io/casbin-mongoose-adapter
Require it in a place, where you are instantiating an enforcer (read more about enforcer here):
1const path = require('path'); 2const { newEnforcer } = require('casbin'); 3const MongooseAdapter = require('@elastic.io/casbin-mongoose-adapter'); 4 5const model = path.resolve(__dirname, './your_model.conf'); 6const adapter = await MongooseAdapter.newAdapter('mongodb://your_mongodb_uri:27017'); 7const enforcer = await newEnforcer(model, adapter);
That is all what required for integrating the adapter into casbin. Casbin itself calls adapter methods to persist updates you made through it.
You can pass mongooose-specific options when instantiating the adapter:
1const MongooseAdapter = require('@elastic.io/casbin-mongoose-adapter'); 2const adapter = await MongooseAdapter.newAdapter('mongodb://your_mongodb_uri:27017', { mongoose_options: 'here' });
Additional information regard to options you can pass in you can find in mongoose documentation
You can create an adapter instance that will load only those rules you need to.
A simple case for it is when you have separate policy rules for separate domains (tenants). You do not need to load all the rules for all domains to make an authorization in specific domain.
For such cases, filtered adapter exists in casbin.
1const MongooseAdapter = require('@elastic.io/casbin-mongoose-adapter'); 2const adapter = await MongooseAdapter.newFilteredAdapter('mongodb://your_mongodb_uri:27017');
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/19 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
52 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More