Go的角色访问控制 goRBAC

码农软件 · 软件分类 · 安全相关框架 · 2019-10-02 10:13:14

软件介绍

goRBAC 为 Go 语言应用提供了轻量级的基于角色的访问控制。

该包适用于:

* 实体具有一个或多个角色
* 角色需要分配权限
* 权限需要分配给角色

因此,RBAC 具有以下模型:

* 在实体和角色之间具有多对多关系
* 在角色和权限之间具有多对多关系
* 角色可以具有父角色(权限继承)

示例代码:

import github.com/mikespook/gorbac

rbac := gorbac.New()

rbac := gorbac.NewWithFactory(YourOwnFactory)

rbac.Add("editor", []string{"edit.article"}, nil)   
rbac.Set("master", []string{"del.article"}, []string{"editor"})

rbac.IsGranted("editor", "edit.article", nil)

本文地址:https://www.codercto.com/soft/d/15861.html

Tales from Facebook

Tales from Facebook

Daniel Miller / Polity Press / 2011-4-1 / GBP 55.00

Facebook is now used by nearly 500 million people throughout the world, many of whom spend several hours a day on this site. Once the preserve of youth, the largest increase in usage today is amongst ......一起来看看 《Tales from Facebook》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具