accession

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Copyright 2019-2020 Axetroy. All rights reserved. MIT license.

Index

Constants

This section is empty.

Variables

View Source
var (
	AdminAdminGet    = New("admin::get", "有权限获取横幅信息")
	AdminAdminCreate = New("admin::create", "有权限创建新横幅")
	AdminAdminUpdate = New("admin::update", "有权限修改横幅信息")
	AdminAdminDelete = New("admin::delete", "有权限删除横幅")

	AdminNewsGet    = New("news::get", "有权限获取新闻")
	AdminNewsCreate = New("news::create", "有权限创建新闻")
	AdminNewsUpdate = New("news::update", "有权限修改新闻")
	AdminNewsDelete = New("news::delete", "有权限删除新闻")

	AdminUserGet    = New("user::get", "有权限获取用户信息")
	AdminUserCreate = New("user::create", "有权限创建新用户")
	AdminUserUpdate = New("user::update", "有权限修改用户信息")
	AdminUserDelete = New("user::delete", "有权限删除用户")
	AdminUserExport = New("user::export", "有权限导出用户到CSV等")

	AdminMenuGet    = New("menu::get", "有权限获取菜单信息")
	AdminMenuCreate = New("menu::create", "有权限创建新菜单")
	AdminMenuUpdate = New("menu::update", "有权限修改菜单信息")
	AdminMenuDelete = New("menu::delete", "有权限删除菜单")

	AdminBannerGet    = New("banner::get", "有权限获取横幅信息")
	AdminBannerCreate = New("banner::create", "有权限创建新横幅")
	AdminBannerUpdate = New("banner::update", "有权限修改横幅信息")
	AdminBannerDelete = New("banner::delete", "有权限删除横幅")

	AdminReportGet    = New("report::get", "有权限获取反馈信息")
	AdminReportUpdate = New("report::update", "有权限修改反馈信息")
	AdminReportDelete = New("report::delete", "有权限删除反馈信息")

	// 管理员的所有权限
	AdminList = []*Accession{
		AdminAdminGet,
		AdminAdminCreate,
		AdminAdminUpdate,
		AdminAdminDelete,

		AdminNewsGet,
		AdminNewsCreate,
		AdminNewsUpdate,
		AdminNewsDelete,

		adminNotificationGet,
		adminNotificationUpdate,
		adminNotificationDelete,
		adminNotificationCreate,

		AdminUserGet,
		AdminUserCreate,
		AdminUserUpdate,
		AdminUserDelete,
		AdminUserExport,

		AdminMenuGet,
		AdminMenuCreate,
		AdminMenuUpdate,
		AdminMenuDelete,

		AdminBannerGet,
		AdminBannerCreate,
		AdminBannerUpdate,
		AdminBannerDelete,

		AdminReportGet,
		AdminReportUpdate,
		AdminReportDelete,
	}

	AdminMap = map[string]*Accession{}
)
View Source
var (
	// 用户类
	ProfileUpdate   = New("profile::update", "有权限修改用户资料")
	PasswordUpdate  = New("password::update", "有权限更改自己的密码")
	Password2Set    = New("password2.set", "有权限设置二级密码")
	Password2Reset  = New("password2.reset", "有权限重置二级密码")
	Password2Update = New("password2::update", "有权限修改二级密码")
	DoTransfer      = New("transfer::create", "有权限发起转账交易")

	// 用户的所有的权限
	List = []*Accession{
		ProfileUpdate,
		PasswordUpdate,
		Password2Set,
		Password2Update,
		DoTransfer,
	}

	Map = map[string]*Accession{}
)

Functions

func FilterAdminAccession

func FilterAdminAccession(AccessionStr []string) (accession []string)

筛选出有效的管理员权限

func Stringify

func Stringify(a ...*Accession) (list []string)

把权限转化成字符串

func Valid

func Valid(s []string) bool

校验一个权限是否是合法的字符串

func ValidAdmin added in v0.3.0

func ValidAdmin(s []string) bool

校验一个权限是否是合法的字符串

Types

type Accession

type Accession struct {
	Name        string `json:"name"`        // 权限标识符
	Description string `json:"description"` // 权限描述
}

func New

func New(name string, description string) *Accession

生成一个新的实例

func Normalize

func Normalize(AccessionStr []string) (list []Accession)

把权限字符串转化成权限模型

Jump to

Keyboard shortcuts

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