Comments (4)
Casbin supports RBAC model with role hierarchy. You can view 1st level roles as role and 2nd level roles as authority.
The examples for a web service are here: https://github.com/casbin/casbin#others. Pay more attention to the Intel RMD
example and their policy rules.
from casbin.
sorry,i still don't know how does casbin work with user role authority resource model,could you give an example?
from casbin.
The basic RBAC model works with your scenario. You can see the model file and policy file in the above link. The content of the model file is:
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && r.act == p.act
The policy file can be:
p, authority1, resource1, read
p, authority2, resource2, read
p, authority2, resource2, write
g, alice, role1
g, bob, role2
g, role1, authority1
g, role2, authority2
This policy means:
alice -> role1 -> authority1 -> resource1
bob-> role2 -> authority2 -> resource2
from casbin.
Suppose it has been solved.
from casbin.
Related Issues (20)
- [Feature] GetImplicitPermissionsForUser optimize 99% latency by avoid using roleManager.hasLinkHelper HOT 1
- [Feature] Adapter supports ctx HOT 3
- [Question] RBAC matcher function isn't called with inherited roles HOT 1
- [Question] Condition Role Manager can support pattern domain For user -> role link HOT 3
- Error encountered when creating an Enforcer based on the ABAC model: extraneous or missing "in quoted field" HOT 2
- [Feature] support return err in GetPermissionsForUser HOT 3
- [Question] - How can I enforce hierarchy check for request to match both domain and tenant? HOT 1
- [Question] How to get permissions while using resource roles HOT 2
- [Question] How to delete role in domain HOT 2
- [Question] HOT 2
- [Question] Why doesn't DeleteRole delete role completely from the policies? HOT 1
- [Question] Why CachedEnforcer uses sync.RWMutex just like sync.Mutex? HOT 6
- [Question] Is it expected that keyMatch3 handles `*` pattern? HOT 3
- [Bug]`GetRolesForUser("userId")` will raise nil error when using RBAC with conditions. HOT 5
- [Bug] nil pointer panic when calling role related functions with no role definition model HOT 2
- [Question] Implement row-level and column-level authorization for data in DB HOT 3
- [Feature] improve code quality by involve strict static check HOT 1
- [Question] Establish rules of users of different organizations visibility HOT 5
- [Question] Effects are ignored for any policy/request other than the first one HOT 3
- How can I design a matcher that looks for membership in two (g & g2) role_definitions? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from casbin.