SkillAgentSearch skills...

Grbac

Golang library implements RBAC (role-based access control)

Install / Use

/learn @vadim-su/Grbac
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

GRBAC Build Status Coverage Status GoDoc

GRBAC is a fast Golang library which provides a role-based access control.

The project is written with a focus on performance, minimalism, and a small number of abstractions.

Install

Run this command

go get -v github.com/deterok/grbac

or

go get -v gopkg.in/deterok/grbac.v1

Usage

// Create User role
roleU := NewRole("User")

// Add the permissions to the User role
roleU.Permit("CreateMsg")
roleU.Permit("ReadMsg")

// Create Admin role
roleA := NewRole("Admin")

// Add the permissions to the Admin role
roleA.Permit("EditMsg")
roleA.Permit("DelMsg")

// Set the parent
roleA.SetParent(roleU)

// Check the permissions
if roleA.IsAllowed("CreateMsg", "ReadMsg", "EditMsg", "DelMsg") {
	fmt.Println("All permissions are allowed for the Admin role!")
}

More examples in godoc

Contributing

Pull requests and stars are welcome. For bugs and feature requests, please create an issue.

License

Copyright (C) 2016, Vadim Suharnikov. Released under the MIT license.

Related Skills

View on GitHub
GitHub Stars9
CategoryDevelopment
Updated3y ago
Forks0

Languages

Go

Security Score

75/100

Audited on Mar 14, 2023

No findings