roles

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package roles is intended to provide Roles Based access controls for users and channels. This is a work in progress, and is likely to chnage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, role string) bool

Check verifies the the current user has the requested role

func CheckAll

func CheckAll(ctx context.Context, want []string) bool

CheckAll checks that the user has all of the request roles.

func CheckAny

func CheckAny(ctx context.Context, want []string) bool

CheckAny checks to see if the current user has any one of the request roles.

func FromContext

func FromContext(ctx context.Context) map[string]struct{}

FromContext retrieves a set of roles from the current context

func Register

func Register()

Register installs this handler on bot.DefaultBot

Types

type Handler

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

Handler implements support for user roles

func New

func New(up hugot.Handler, cs command.Set, s storage.Storer) *Handler

New creates a new roles handler.

func (*Handler) Describe

func (h *Handler) Describe() (string, string)

Describe implements the Describer interface for the alias handler

func (*Handler) Help

func (h *Handler) Help(w io.Writer) error

Help implements the command.Helper interfaace for the alias handler

func (*Handler) ProcessMessage

func (h *Handler) ProcessMessage(ctx context.Context, w hugot.ResponseWriter, m *hugot.Message) error

ProcessMessage adds any roles the user has to the context

Jump to

Keyboard shortcuts

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