Comments (13)
Can you explain why this isn't supported?
I created this model file and it seems to work fine.
[request_definition]
r = sub, dom, 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.dom) && r.obj == p.obj && r.act == p.act
============================================================
p, read_role, data1, read
p, read_role, data2, read
p, write_role, data1, write
p, write_role, data2, write
g, alice, read_role, pepsi
g, alice, write_role, coke
============================================
domain is assigned in the group and not in the policy.
Enforcement works with this model.
from node-casbin.
Can you give more users/groups/domains in your example, like 2 or 3. I can't definitely tell what you are trying to do with only one user and one domain.
from node-casbin.
Sure, is this better to understand?
p, group_admin, subject_blog, permission_* # groups are defined on a global scope without domain relation
p, group_manager, subject_blog, permission_write
p, group_guest, subject_blog, permission_read
g, group_manager, group_guest # manager inherits guest permissions
g, user_a, group_admin, domain_7 # groups are assigned on domain level
g, user_b, group_admin, domain_3
g, user_c, group_guest, domain_3
g, user_d, group_user, domain_1
from node-casbin.
@Slind14 casbin does not support this.
from node-casbin.
@dwang7 I apologize for my answer, you are right.
from node-casbin.
Thanks for the confirmation.
One question. Is it possible to define a domain group and reference that domain group in the role?
ie:
my_domains: (pepsi, coke, sprite)
g, alice, read_role, my_domains
how would I do this in casbin?
If not, any pointers on how and where to implement this functionality?
from node-casbin.
@dwang7 Awesome! You can do that, this is something I didn't expect 👍
from node-casbin.
@dwang7 Awesome! You can do that, this is something I didn't expect 👍
@nodece so you're saying its not possible to do this currently?
from node-casbin.
@dwang7 I mean you can do that, this is a good idea.
from node-casbin.
@dwang7 please raise a new GitHub issue for a new question.
from node-casbin.
@dwang7 I mean you can do that, this is a good idea.
adding domain_groups feature to pycasbin in a forked repo
from node-casbin.
@dwang7 great to see it! Can you explain how it works and even make a PR to the official repo?
from node-casbin.
This is just an initial commit. Wanted to get some feedback on my implementation. Its not optimized for large data sets yet.
Basically, I've added a new ptype, d, which is domain_groups.
https://github.com/dwang7/pycasbin/blob/master/examples/rbac_with_domain_groups_model.conf
https://github.com/dwang7/pycasbin/blob/master/examples/rbac_with_domain_groups_policy.csv
When you add to the roles, g, you can specify the domain_group instead of the domain.
g, bob, read_role, beverages
d, pepsi, beverages
d, coke, beverages
d, sprite, beverages
from node-casbin.
Related Issues (20)
- Problem "invalid group" with v5.24.4 and later HOT 10
- `RBAC with Domains API` # `e.getUsersForRoleInDomain` doesn't work. HOT 3
- FileAdapter doesn't escape values when saving policy HOT 6
- [Question] Policy_effect 'deny' does not work when combining multiple models in one model configuration HOT 3
- Prefered way to use casbin in a web framework with lots of users? HOT 2
- No Cloudflare Workers support? HOT 2
- Casbin Watcher for Prisma ORM HOT 4
- Add to Nest.js docs HOT 1
- KeyMatch5 does not match the expected result HOT 1
- [email protected]: The expression-eval npm package is no longer maintained HOT 5
- [feature] ABAC support for EnableAcceptJsonRequest() HOT 2
- enforcer.deleteUser() wiped out all data from `casbin_rule` table HOT 1
- Without enforcer.loadPolicy() Casbin behave unpredictably on mass updates. HOT 1
- [Bug] Can't resolve 'fs' HOT 7
- [bug] When using ‘watcherEx’, deletion does not trigger it; you need to configure a ‘watcher’ for it to work. HOT 2
- [Bug] The lack of a constructor results in the default configuration not taking effect. HOT 3
- addMatchingFunc HOT 2
- usage of addMatchingFunc HOT 2
- [Question] Can the cache stored in memory here be placed in Redis? HOT 3
- Why I can't use enforcer to judge the req using the rbac modle? HOT 1
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 node-casbin.