authorization

package
v1.27.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// HEAD: Represents the HTTP HEAD method, which is used to retrieve metadata of a resource without
	// fetching the resource itself.
	HEAD = "head"
	// VALIDATE: Represents a custom action to validate a resource.
	// This is not a standard HTTP method but can be used for specific validation operations.
	VALIDATE = "validate"
	// LIST: Represents a custom action to list resources.
	// This is not a standard HTTP method but can be used to list multiple resources.
	LIST = "list"
	// GET: Represents the HTTP GET method, which is used to retrieve a resource.
	GET = "get"
	// ADD: Represents a custom action to add a resource.
	// This is not a standard HTTP method but can be used for specific add operations.
	ADD = "add"
	// CREATE: Represents the HTTP POST method, which is used to create a new resource.
	CREATE = "create"
	// RESTORE: Represents a custom action to restore a resource.
	// This is not a standard HTTP method but can be used for specific restore operations.
	RESTORE = "restore"
	// DELETE: Represents the HTTP DELETE method, which is used to delete a resource.
	DELETE = "delete"
	// UPDATE: Represents the HTTP PUT method, which is used to update an existing resource.
	UPDATE = "update"
)
View Source
const (
	// ALL_SCHEMA represents all schema-related resources.
	ALL_SCHEMA = "schema/*"
	// SCHEMA_TENANTS represents the schema tenants resource.
	SCHEMA_TENANTS = "schema/tenants"
	// SCHEMA_OBJECTS represents the schema objects resource.
	SCHEMA_OBJECTS = "schema/objects"
	// ALL_TRAVERSAL represents all traversal-related resources.
	ALL_TRAVERSAL = "traversal/*"
	// ALL_CLASSIFICATIONS represents all classification-related resources.
	ALL_CLASSIFICATIONS = "classifications/*"
	// NODES represents the nodes resource.
	NODES = "nodes"
	// CLUSTER represents the cluster resource.
	CLUSTER = "cluster"
	// ALL_BATCH represents all batch-related resources.
	ALL_BATCH = "batch/*"
	// BATCH_OBJECTS represents the batch objects resource.
	BATCH_OBJECTS = "batch/objects"
	// OBJECTS represents the objects resource.
	OBJECTS = "objects"
)

Variables

This section is empty.

Functions

func Backup added in v1.27.0

func Backup(backend, id string) string

Backup returns the path for a specific backup. Parameters: - backend: The backup backend name. - id: The backup ID (optional). Returns: The formatted backup path.

func Objects added in v1.27.0

func Objects(class string, id strfmt.UUID) string

Objects returns the path for a specific object or class. Parameters: - class: The class name (optional). - id: The object ID (optional). Returns: The formatted objects path.

func Restore added in v1.27.0

func Restore(backend, id string) string

Restore returns the path for restoring a specific backup. Parameters: - backend: The backup backend name. - id: The backup ID. Returns: The formatted restore path.

func SchemaShard added in v1.27.0

func SchemaShard(class, shard string) string

SchemaShard returns the path for a specific schema shard. Parameters: - class: The class name. - shard: The shard name. Returns: The formatted schema shard path.

Types

type Authorizer

type Authorizer interface {
	Authorize(principal *models.Principal, verb, resource string) error
}

Authorizer always makes a yes/no decision on a specific resource. Which authorization technique is used in the background (e.g. RBAC, adminlist, ...) is hidden through this interface

func New

func New(cfg config.Config) Authorizer

New Authorizer based on the application-wide config

type DummyAuthorizer

type DummyAuthorizer struct{}

DummyAuthorizer is a pluggable Authorizer which can be used if no specific authorizer is configured. It will allow every auth decision, i.e. it is effectively the same as "no authorization at all"

func (*DummyAuthorizer) Authorize

func (d *DummyAuthorizer) Authorize(principal *models.Principal, verb, resource string) error

Authorize on the DummyAuthorizer will allow any subject access to any resource

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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