role

package
v0.0.0-...-d125d34 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PE         string = "pe"
	Owner      string = "owner"
	Maintainer string = "maintainer"
	Guest      string = "guest"
)

Variables

View Source
var (
	ErrorRoleNotFound   = errors.New("role not found")
	ErrorLoadCheckError = errors.New("load check error")
)

Functions

func CheckRoleIfValid

func CheckRoleIfValid(role string) bool

Types

type CompResult

type CompResult uint8
const (
	RoleEqual CompResult = iota
	RoleBigger
	RoleSmaller
	RoleCanNotCompare
)

type Service

type Service interface {
	// ListRole Lists all the role
	ListRole(ctx context.Context) ([]types.Role, error)
	// GetRole get role by the role name
	GetRole(ctx context.Context, roleName string) (*types.Role, error)
	// RoleCompare compare if the role1's permission is higher than role2
	RoleCompare(ctx context.Context, role1, role2 string) (CompResult, error)
	// GetDefaultRole return the default role(no default role will return nil)
	GetDefaultRole(ctx context.Context) *types.Role
}

func NewFileRole

func NewFileRole(ctx context.Context, reader io.Reader) (Service, error)

func NewFileRoleFrom2

func NewFileRoleFrom2(ctx context.Context, config roleconfig.Config) (Service, error)

Jump to

Keyboard shortcuts

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