adminlist

package
v1.23.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const AnonymousPrincipalUsername = "anonymous"

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorizer

type Authorizer struct {
	// contains filtered or unexported fields
}

Authorizer provides either full (admin) or no access

func New

func New(cfg Config) *Authorizer

New Authorizer using the AdminList method

func (*Authorizer) Authorize

func (a *Authorizer) Authorize(principal *models.Principal, verb, resource string) error

Authorize will give full access (to any resource!) if the user is part of the admin list or no access at all if they are not

type Config

type Config struct {
	Enabled        bool     `json:"enabled" yaml:"enabled"`
	Users          []string `json:"users" yaml:"users"`
	ReadOnlyUsers  []string `json:"read_only_users" yaml:"read_only_users"`
	Groups         []string `json:"groups" yaml:"groups"`
	ReadOnlyGroups []string `json:"read_only_groups" yaml:"read_only_groups"`
}

Config makes every subject on the list an admin, whereas everyone else has no rights whatsoever

func (Config) Validate

func (c Config) Validate() error

Validate admin list config for viability, can be called from the central config package

Jump to

Keyboard shortcuts

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