access

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2020 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VIEW uint16 = 2 << iota
	DISABLE
	REMOVE
	EDIT
	CREATE
	EXPORT
	IMPORT
	BATCH
	GET
	POST
	PUT
	DELETE
	OPTION
	GRANT
	REVOKE
	ALL         = ^uint16(0) // 65535
	NONE uint16 = 0          // 无权限
)

操作列表

Variables

View Source
var (
	AccessCodes []uint16
	AccessNames = map[uint16]string{
		VIEW: "view", DISABLE: "disable", REMOVE: "remove", EDIT: "edit",
		CREATE: "create", EXPORT: "export", IMPORT: "import", BATCH: "batch",
		GET: "get", POST: "post", PUT: "put", DELETE: "delete", OPTION: "option",
		GRANT: "grant", REVOKE: "revoke", ALL: "all", NONE: "",
	}
	AccessTitles = map[uint16]string{
		VIEW: "查看", DISABLE: "禁用", REMOVE: "删除", EDIT: "编辑",
		CREATE: "新建", EXPORT: "导出", IMPORT: "导入", BATCH: "批量",
		GET: "GET", POST: "POST", PUT: "PUT", DELETE: "DELETE", OPTION: "OPTION",
		GRANT: "授权", REVOKE: "撤销", ALL: "全部", NONE: "无",
	}
)

Functions

func ContainAction

func ContainAction(perm, act uint16, strict bool) bool

func GetPermTitles

func GetPermTitles(codes []uint16) (titles []string)

找出权限的中文名称

func ParsePermNames

func ParsePermNames(perm uint16) (codes []uint16, names []string)

分解出具体权限

Types

type CodeSlice added in v1.0.4

type CodeSlice []uint16

func (CodeSlice) Len added in v1.0.4

func (p CodeSlice) Len() int

func (CodeSlice) Less added in v1.0.4

func (p CodeSlice) Less(i, j int) bool

func (CodeSlice) Swap added in v1.0.4

func (p CodeSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL