acl

package
v0.1.0-alpha4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package acl provides all functionality within arrebato regarding access-control lists. This includes both gRPC, raft and data store interactions.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidACL = errors.New("invalid ACL")

ErrInvalidACL is the error given when an ACL is invalid.

View Source
var ErrNoACL = errors.New("no acl")

ErrNoACL is the error given when querying the server's ACL before one has been initially created.

Functions

func Normalize

func Normalize(ctx context.Context, a *acl.ACL) (*acl.ACL, error)

Normalize the ACL, removing duplicate permissions and entries. This function will also detect invalid entries and return an error if one is found.

Types

type BoltStore

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

The BoltStore type is responsible for querying/mutating ACL data within a boltdb database.

func NewBoltStore

func NewBoltStore(db *bbolt.DB) *BoltStore

NewBoltStore returns a new instance of the BoltStore type that will manage/query ACL data in a boltdb database.

func (*BoltStore) Allowed

func (bs *BoltStore) Allowed(ctx context.Context, topic, client string, permission acl.Permission) (bool, error)

Allowed returns a boolean value indicating if the client has the given permission on a topic. This method returns true in scenarios where an ACL has yet to be created.

func (*BoltStore) Get

func (bs *BoltStore) Get(_ context.Context) (*acl.ACL, error)

Get the ACL from the store.

func (*BoltStore) Set

func (bs *BoltStore) Set(_ context.Context, a *acl.ACL) error

Set the ACL to the one provided.

type Executor

type Executor interface {
	Execute(ctx context.Context, cmd command.Command) error
}

The Executor interface describes types that execute commands related to ACL data.

type GRPC

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

The GRPC type is an aclsvc.ACLServiceServer implementation that handles inbound gRPC requests to manage and query the server ACL.

func NewGRPC

func NewGRPC(executor Executor, acl Getter) *GRPC

NewGRPC returns a new instance of the GRPC type that will modify ACL data via commands sent to the Executor and query ACL data via the Getter implementation.

func (*GRPC) Get

func (svr *GRPC) Get(ctx context.Context, _ *aclsvc.GetRequest) (*aclsvc.GetResponse, error)

Get the server's current ACL state.

func (*GRPC) Register

func (svr *GRPC) Register(registrar grpc.ServiceRegistrar, health *health.Server)

Register the GRPC service onto the grpc.ServiceRegistrar.

func (*GRPC) Set

func (svr *GRPC) Set(ctx context.Context, request *aclsvc.SetRequest) (*aclsvc.SetResponse, error)

Set the server's new ACL state.

type Getter

type Getter interface {
	Get(ctx context.Context) (*acl.ACL, error)
}

The Getter interface describes types that can return the current server ACL.

type Handler

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

The Handler type is responsible for handling commands sent to the server regarding ACL state.

func NewHandler

func NewHandler(setter Setter, logger hclog.Logger) *Handler

NewHandler returns a new instance of the Handler type that will handle inbound commands regarding ACLs.

func (*Handler) Set

func (h *Handler) Set(ctx context.Context, cmd *aclcmd.SetACL) error

Set handles a command that modifies the current ACL state.

type Setter

type Setter interface {
	Set(ctx context.Context, a *acl.ACL) error
}

The Setter interface describes types that can set ACL state.

Jump to

Keyboard shortcuts

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