Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why not return error when setting parents if there is a circle error #30

Closed
hsluoyz opened this issue Jul 12, 2017 · 3 comments
Closed
Assignees
Labels

Comments

@hsluoyz
Copy link
Member

hsluoyz commented Jul 12, 2017

Several advices:

SetParent, if you set 1 to a, then a == 1, but SetParent is more like AddParent
If there are some potential circle errors, they should be thrown immediately rather than at runtime

Hi @nullne,

please try to use Casbin. It has a better RBAC API. For example, you can use AddRoleForUser() to add a role for a user or a role. And you can remove it by DeleteRoleForUser() as well.

Casbin is an authorization library that supports models like ACL, RBAC, ABAC.

Related to RBAC, Casbin has several advantages:

  1. roles can be cascaded, aka roles can have roles.
  2. support resource roles, so users have their roles and resource have their roles too. role = group here.
  3. the permission assignments (or policy in Casbin's language) can be persisted in files or database (MySQL and Cassandra).

And you can even customize your own access control model, for example, mix RBAC and ABAC together by using roles and attributes at the same time. It's very flexible.

@hsluoyz hsluoyz self-assigned this Jul 12, 2017
@nullne
Copy link

nullne commented Jul 12, 2017

thank you for your efforts. I considered about casbin along with gorbac. Though casbin is more powerful, I only need a RBAC implementation. so I picked gorbac. It's really horrible in naming and design. It's tough to coding on that lib. But it have already made it! 💯

@hsluoyz
Copy link
Member Author

hsluoyz commented Jul 12, 2017

OK. Not only about flexibility, Casbin has supported policy storage on most DBs after supporting Xorm. So it may be a better choice if you want to persist the rules. I will close this now!

@hsluoyz hsluoyz closed this as completed Jul 12, 2017
@nullne
Copy link

nullne commented Jul 12, 2017

I persist the rules by myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants