permission

package
v0.2.49 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildOptions

func BuildOptions(lang string) []datastruct.Option[string, Enum]

func CheckAnyRole added in v0.2.17

func CheckAnyRole(roleId uint64) bool

func CheckRole added in v0.0.3

func CheckRole(roleId uint64, permission Enum) bool

CheckRole 检查某人是否有某权限

func InvalidateRole added in v0.2.11

func InvalidateRole(roleId uint64)

Types

type Enum

type Enum int
const (
	Admin Enum = iota
	UserManager
	TopicsManager
	PageManager
	RoleManager
	SiteManager
)

func All added in v0.2.17

func All() []Enum

func GetPermissionByRoleId added in v0.1.1

func GetPermissionByRoleId(roleId uint64) []Enum

GetPermissionByRoleId 获取单个角色的权限(带缓存)

func (Enum) Id

func (receiver Enum) Id() uint64

func (Enum) LocalizedName added in v0.2.46

func (receiver Enum) LocalizedName(lang string) string

LocalizedName returns the permission label translated into lang.

func (Enum) Name

func (receiver Enum) Name() string

Name returns the permission label in the fallback locale (zh). Prefer LocalizedName when a request locale is available.

Jump to

Keyboard shortcuts

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