policies

package
v0.0.0-...-bb13912 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2017 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithErrNotFound

func WithErrNotFound(err error) error

WithErrNotFound adds a errNotFoundBehavior to the given error.

Types

type Permission

type Permission struct {
	// The resource name concerned by the permission.
	Resource string `json:"resource,omitempty" yaml:"resource"`
	// The optional paths on which the permission apply.
	Paths []string `json:"paths,omitempty" yaml:"paths"`
	// Can be used to disable a permission.
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled"`
	// Indicates if the permission grants or denies the access on the resource.
	Deny *bool `json:"deny,omitempty" yaml:"deny"`
}

Permission is the association of a resource and a right.

type Policy

type Policy struct {
	// The policy name.
	Name string `json:"name,omitempty" yaml:"name"`
	// Can be used to disable a policy.
	Enabled *bool `json:"enabled,omitempty" yaml:"enabled"`
	// An array of resource and their associated right.
	Permissions []Permission `json:"permissions,omitempty" yaml:"permissions"`
}

Policy represents a set of permissions, assignable to a session.

type Repository

type Repository interface {
	FindByName(ctx context.Context, name string) (*Policy, error)
}

Repository provides access to a policy store.

Jump to

Keyboard shortcuts

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