Help us shape the future of Go! Take the 2026 Go Developer Survey

authorization

package
v0.4.26 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleEditor = "editor"
	RoleViewer = "viewer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Permission

type Permission string

Permission identifies an action that may be granted to a role.

const (
	PermRead   Permission = "read"
	PermCreate Permission = "create"
	PermUpdate Permission = "update"
	PermDelete Permission = "delete"
)

type PermissionError

type PermissionError struct {
	Permission Permission
}

func (*PermissionError) Error

func (e *PermissionError) Error() string

type Service

type Service struct{}

Service evaluates role/permission pairs. Unknown roles and permissions deny by default.

func NewService

func NewService() *Service

func (*Service) Allowed

func (s *Service) Allowed(roles []string, permission Permission) bool

func (*Service) Authorize

func (s *Service) Authorize(roles []string, permission Permission) error

Jump to

Keyboard shortcuts

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