All Projects → mikespook → Gorbac

mikespook / Gorbac

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

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Gorbac

Audit2rbac
Autogenerate RBAC policies based on Kubernetes audit logs
Stars: ✭ 702 (-38.85%)
Mutual labels:  rbac
Php Casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in PHP .
Stars: ✭ 865 (-24.65%)
Mutual labels:  rbac
Nodeexpressadmin
node实现后台权限管理系统,集成用户登录,权限管理。
Stars: ✭ 44 (-96.17%)
Mutual labels:  rbac
Ngx Permissions
Permission and roles based access control for your angular(angular 2,4,5,6,7,9+) applications(AOT, lazy modules compatible
Stars: ✭ 749 (-34.76%)
Mutual labels:  rbac
Webside
基于RBAC的完全响应式权限管理系统
Stars: ✭ 19 (-98.34%)
Mutual labels:  rbac
Spring Security Rbac Jwt
springboot2项目的脚手架工程(包含security + jwt方式的动态权限校验)
Stars: ✭ 21 (-98.17%)
Mutual labels:  rbac
Pycasbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Python
Stars: ✭ 625 (-45.56%)
Mutual labels:  rbac
Djaoapp
User login, billing, access control as part of a session proxy
Stars: ✭ 61 (-94.69%)
Mutual labels:  rbac
Rbac
Hierarchical Role Based Access Control for NodeJS
Stars: ✭ 857 (-25.35%)
Mutual labels:  rbac
Jbone
jbone基于Spring Cloud框架开发,旨在为中小企业提供稳定的微服务解决方案,为开发人员提供基础开发骨架,jbone包含微服务中所有常用组件,例如注册中心、服务管理、服务监控、JVM监控、内存分析、调用链跟踪、API网关等等。业务功能包括系统权限的统一管理、单点登录、CMS、电商平台、工作流平台、支付平台等等。
Stars: ✭ 961 (-16.29%)
Mutual labels:  rbac
Permission Manager
Permission Manager is a project that brings sanity to Kubernetes RBAC and Users management, Web UI FTW
Stars: ✭ 753 (-34.41%)
Mutual labels:  rbac
Laravel template with vue
laravel5.5和vue.js结合的前后端分离项目模板,后端使用了laravel的LTS版本(5.5),前端使用了流行的vue-element-template项目。作为程序的起点,可以直接以此为基础来进行业务扩展。模板内容包括基础的用户管理和权限管理、日志管理、集成第三方登录,整合laravel-echo-server 实现了websocket 做到了消息的实时推送,并在此基础上,实现了聊天室和客服功能。权限管理包括后端Token认证和前端vue.js的动态权限,解决了前后端完整分离的情况下,vue.js的认证与权限相关的痛点,已在本人的多个项目中集成使用。
Stars: ✭ 763 (-33.54%)
Mutual labels:  rbac
Openstack Policy Editor
A Casbin Policy Editor for OpenStack
Stars: ✭ 28 (-97.56%)
Mutual labels:  rbac
Rbac Manager
A Kubernetes operator that simplifies the management of Role Bindings and Service Accounts.
Stars: ✭ 737 (-35.8%)
Mutual labels:  rbac
Kbframe
一款基于Laravel框架开发的现代化二次开发框架,是高性能,高效率,高质量的企业级开发框架,具有驱动领域,敏捷开发,轻易上手,高内聚低耦合,开箱即用等特点。
Stars: ✭ 47 (-95.91%)
Mutual labels:  rbac
Kubiscan
A tool to scan Kubernetes cluster for risky permissions
Stars: ✭ 659 (-42.6%)
Mutual labels:  rbac
Mcw Securing Paas
MCW Securing PaaS
Stars: ✭ 20 (-98.26%)
Mutual labels:  rbac
Rpg Boilerplate
Relay (React), Postgres, and Graphile (GraphQL): A Modern Frontend and API Boilerplate
Stars: ✭ 62 (-94.6%)
Mutual labels:  rbac
Micro Mesh
gRPC微服务架构实践
Stars: ✭ 50 (-95.64%)
Mutual labels:  rbac
Pig
🚀 The best rbac web framework. base on Spring Boot 2.4、 Spring Cloud 2020、 OAuth2 . Thx Give a star
Stars: ✭ 958 (-16.55%)
Mutual labels:  rbac

goRBAC

Build Status GoDoc Coverage Status

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

For the purposes of this package:

* an identity has one or more roles.
* a role requests access to a permission.
* a permission is given to a role.

Thus, RBAC has the following model:

* many to many relationship between identities and roles.
* many to many relationship between roles and permissions.
* roles can have a parent role (inheriting permissions).

Version

Currently, goRBAC has two versions:

Version 1 is the original design which will only be mantained to fix bugs.

Version 2 is the new design which will be continually mantained with a stable API.

The master branch will be under development with a new API and can be changed without notice.

Install

Install the package:

$ go get github.com/mikespook/gorbac

Usage

Although you can adjust the RBAC instance anytime and it's absolutely safe, the library is designed for use with two phases:

  1. Preparing

  2. Checking

Preparing

Import the library:

import "github.com/mikespook/gorbac"

Get a new instance of RBAC:

rbac := gorbac.New()

Get some new roles:

rA := gorbac.NewStdRole("role-a")
rB := gorbac.NewStdRole("role-b")
rC := gorbac.NewStdRole("role-c")
rD := gorbac.NewStdRole("role-d")
rE := gorbac.NewStdRole("role-e")

Get some new permissions:

pA := gorbac.NewStdPermission("permission-a")
pB := gorbac.NewStdPermission("permission-b")
pC := gorbac.NewStdPermission("permission-c")
pD := gorbac.NewStdPermission("permission-d")
pE := gorbac.NewStdPermission("permission-e")

Add the permissions to roles:

rA.Assign(pA)
rB.Assign(pB)
rC.Assign(pC)
rD.Assign(pD)
rE.Assign(pE)

Also, you can implement gorbac.Role and gorbac.Permission for your own data structure.

After initialization, add the roles to the RBAC instance:

rbac.Add(rA)
rbac.Add(rB)
rbac.Add(rC)
rbac.Add(rD)
rbac.Add(rE)

And set the inheritance:

rbac.SetParent("role-a", "role-b")
rbac.SetParents("role-b", []string{"role-c", "role-d"})
rbac.SetParent("role-e", "role-d")

Checking

Checking the permission is easy:

if rbac.IsGranted("role-a", pA, nil) &&
	rbac.IsGranted("role-a", pB, nil) &&
	rbac.IsGranted("role-a", pC, nil) &&
	rbac.IsGranted("role-a", pD, nil) {
	fmt.Println("The role-a has been granted permis-a, b, c and d.")
}

And there are some built-in util-functions: InherCircle, AnyGranted, AllGranted. Please open an issue for the new built-in requirement.

E.g.:

rbac.SetParent("role-c", "role-a")
if err := gorbac.InherCircle(rbac); err != nil {
	fmt.Println("A circle inheratance occurred.")
}

Persistence

The most asked question is how to persist the goRBAC instance. Please check the post HOW TO PERSIST GORBAC INSTANCE for the details.

Patches

2016-03-03

gofmt -w -r 'AssignPermission -> Assign' .
gofmt -w -r 'RevokePermission -> Revoke' .

Authors

Open Source - MIT Software License

See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].