permission

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

The permission utility package defines primitives that allow to check a Subject for a permission.

E.g. A player's permission Func can be setup on join by subscribing to proxy.PermissionsSetupEvent.

Note: This is a simple package only allowing limited complexity of permission checking and may not suffice everyone's requirements. Therefore Gate also makes no assumptions on whether this package is used or not. Plugins may use their own authorization system internally without a touch on this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func(permission string) TriState

Func is the permission function to obtain the TriState for a permission.

type Subject

type Subject interface {
	HasPermission(permission string) bool // Equal to PermissionValue(...).Bool()
	PermissionValue(permission string) TriState
}

Subject is a permission holder like a player.

type TriState

type TriState uint8

TriState can be in three states (True, False, Undefined), used for a setting.

const (
	Undefined TriState = iota // A permission is undefined.
	True                      // A permission is allowed.
	False                     // A permission is explicitly denied.
)

func (TriState) Bool

func (t TriState) Bool() bool

Bool returns the bool value of a TriState where Undefined is converted to false.

Jump to

Keyboard shortcuts

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