mikespook / gorbac

goRBAC provides a lightweight role-based access control (RBAC) implementation in Golang.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL backed RBAC

swill opened this issue · comments

Maybe this is possible and I am just not clear on how I would implement it. Is it possible for me to save/load my role and permission data out of a mysql database (or another type of DB)?

commented

If you are using RDBMS, two tables will be needed: a) roles b) permissions. The entity-relationship could be like this:

ROLES -(m)--(n)- PERMISSIONS

All that remains is SELECT FROM tables, New a rbac variable and Set/Add roles with permissions.

If you are using NoSQL DB, rbac.Dump and rbac.Restore could help you.