addGroupingPolicy API interface bug
See original GitHub issueWhen using this interface enforcer. addGroupingPolicy (“member”, “group”) to add user to an group, occured java.lang.NullPointerException:
dependencies pom
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jcasbin</artifactId>
<version>1.31.1</version>
</dependency>
<dependency>
<groupId>org.casbin</groupId>
<artifactId>jdbc-adapter</artifactId>
<version>2.3.3</version>
</dependency>
model.conf
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
Application
JDBCAdapter adapter = new JDBCAdapter(driver, url, username, password);
String modelPath = "src/main/resources/cabin/model.conf";
Enforcer enforcer = new Enforcer(modelPath, adapter);
enforcer.addPolicy("admin", "/books", "READ");
boolean policy = enforcer.addGroupingPolicy("tony", "admin"); // Exception in thread "main" java.lang.NullPointerException
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Can not add role for a user in case g = _, _, _ #25 - GitHub
it accepts user and role, but all it does is just passing them by to addGroupingPolicy which also has hard-coded user and role....
Read more >Simplified identity with 'Sign-in with Google' and Casbin
Combining “Sign in with Google” with Casbin you can add authentication and authorization to a Cloud Run service without using any identity provider...
Read more >casbin package - github.com/seacoastboy/casbin - Go Packages
Enforcer is the main interface for authorization enforcement and policy management. ... func (e *Enforcer) AddGroupingPolicy(params ...interface{}) bool.
Read more >Management API | Casbin
The primitive API that provides full support for Casbin policy management. ... AddGroupingPolicy adds a role inheritance rule to the current policy.
Read more >changelog - Debian Package Tracker
Bug fixes: * Install new Essential or Required packages with the commands "full-upgrade" (command line) and MarkUpgradable ('U' in the curses interface) ...
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
I took a look and found that this is not a bug, acutrally
addGroupingPolicy()
is a role inheritance, so inmodel.conf
should include a[role_definition]
just look like follows.Verified, I will fix it.