audit

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindAuditContext

func BindAuditContext(ac *Controller) func(ctx *APICtx, rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc)

BindAuditContext Helper middleware to bind module to API context

Types

type APICtx

type APICtx struct {
	// Base context required by router
	*appcontext.AuthPlzCtx
	// contains filtered or unexported fields
}

APICtx API context instance

func (*APICtx) GetEvents

func (c *APICtx) GetEvents(rw web.ResponseWriter, req *web.Request)

GetEvents endpoint fetches a list of audit events for a given user

type Controller

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

Controller instance

func NewController

func NewController(store Storer) *Controller

NewController Instantiates an audit controller

func (*Controller) AddEvent

func (ac *Controller) AddEvent(userExtID, eventType string, eventTime time.Time, data map[string]string) error

AddEvent adds an event to the audit log

func (*Controller) BindAPI

func (ac *Controller) BindAPI(router *web.Router)

BindAPI binds the AuditController API to a provided router

func (*Controller) HandleEvent

func (ac *Controller) HandleEvent(event interface{}) error

HandleEvent handles async events for go-async

func (*Controller) ListEvents

func (ac *Controller) ListEvents(userid string) ([]interface{}, error)

ListEvents fetches events for the provided userID

type Event

type Event interface {
	GetUserExtID() string
	GetType() string
	GetTime() time.Time
	GetData() map[string]string
}

Event Audit event type interface

type Storer

type Storer interface {
	AddAuditEvent(userid, eventType string, eventTime time.Time, data map[string]string) (interface{}, error)
	GetAuditEvents(userid string) ([]interface{}, error)
}

Storer Interface that datastore must implement to provide audit controller

type User

type User interface {
	GetExtID() string
}

User Audit user type interface

Jump to

Keyboard shortcuts

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