Open PoyuLU opened 1 year ago
@nodece @Zxilly @Shivansh-yadav13
@nodece @Zxilly @Shivansh-yadav13
Hi, anyone can give me some tips how to modified domain in node.casbin, thank you.
Looks like you implement role management without casbin?
const allowedRoles = metadata.allowedRoles;
if (!allowedRoles) return AuthorizationDecision.ALLOW;
if (allowedRoles.length < 1) return AuthorizationDecision.DENY;
Looks like you implement role management without casbin?
const allowedRoles = metadata.allowedRoles; if (!allowedRoles) return AuthorizationDecision.ALLOW; if (allowedRoles.length < 1) return AuthorizationDecision.DENY;
And you create enforcer everytime
const enforcer = await this.enforcerFactory(role);
Seems not a good practice, if you use rbac in casbin, it has to rebuild the whole role graph every time.
I have casbin in different file. How to access the domain value and compare with RBAC with domain model in the above code?
[request_definition] r = sub, dom, obj, act
[policy_definition] p = sub, dom, obj, act
[roledefinition] g = , ,
[policy_effect] e = some(where (p.eft == allow))
[matchers] m = g(r.sub, p.sub, r.dom) && r.dom == p.dom && r.obj == p.obj && r.act == p.act
I think you use this file and want to add domain support? https://github.com/loopbackio/loopback-next/blob/master/examples/access-control-migration/src/components/casbin-authorization/services/casbin.authorizer.ts
Please ref to https://github.com/casbin/node-casbin/blob/master/test/rbacwDomainAPI.test.ts
I think you use this file and want to add domain support? https://github.com/loopbackio/loopback-next/blob/master/examples/access-control-migration/src/components/casbin-authorization/services/casbin.authorizer.ts
Please ref to https://github.com/casbin/node-casbin/blob/master/test/rbacwDomainAPI.test.ts
What if I have thousands of users, how do I check their roles and domains dynamically?
how to add domain in casbin.authorizer?