audit

package
v1.24.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuditMark   = "needAudit"
	AuditAction = "auditAction"
)
View Source
const (
	AuditSubjectKey   = "audit_subject"
	AuditExtraDataKey = "audit_extra_datas"
)

Variables

This section is empty.

Functions

func GetAuditData

func GetAuditData(c *gin.Context) map[string]string

func GetExtraAuditData

func GetExtraAuditData(c *gin.Context) (string, map[string]string)

Types

type AuditInterface

type AuditInterface interface {
	AuditProxyFunc(c *gin.Context, p *ProxyObject)
	WebsocketAuditFunc(username string, parents []cache.CommonResourceIface, ip string, proxyobj *ProxyObject) func(cmd string)

	SetAuditData(c *gin.Context, action, mod, name string)
	SetExtraAuditData(c *gin.Context, kind string, uid uint)
	SetExtraAuditDataByClusterNamespace(c *gin.Context, cluster, namesapce string)
}

type DefaultAuditInstance

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

func NewAuditMiddleware

func NewAuditMiddleware(db *gorm.DB, cache *cache.ModelCache, uinterface aaa.ContextUserOperator) *DefaultAuditInstance

func (*DefaultAuditInstance) AuditProxyFunc

func (audit *DefaultAuditInstance) AuditProxyFunc(c *gin.Context, proxyobj *ProxyObject)

func (*DefaultAuditInstance) Consumer

func (audit *DefaultAuditInstance) Consumer(ctx context.Context) error

func (*DefaultAuditInstance) Log

func (audit *DefaultAuditInstance) Log(username, module, tenant, operation, name string, labels map[string]string, raw interface{}, success bool, ip string)

func (*DefaultAuditInstance) LogIt

func (audit *DefaultAuditInstance) LogIt(c *gin.Context, t time.Time, raw gin.H)

func (*DefaultAuditInstance) Middleware

func (audit *DefaultAuditInstance) Middleware() func(c *gin.Context)

func (*DefaultAuditInstance) SaveAuditLog

func (audit *DefaultAuditInstance) SaveAuditLog(c *gin.Context)

func (*DefaultAuditInstance) SetAuditData

func (audit *DefaultAuditInstance) SetAuditData(c *gin.Context, action, module, name string)

SetAuditData set audit data in context

func (*DefaultAuditInstance) SetExtraAuditData

func (audit *DefaultAuditInstance) SetExtraAuditData(c *gin.Context, kind string, uid uint)

SetExtraAuditData set audit extra data in context

func (*DefaultAuditInstance) SetExtraAuditDataByClusterNamespace

func (audit *DefaultAuditInstance) SetExtraAuditDataByClusterNamespace(c *gin.Context, cluster, namespace string)

SetExtraAuditDataByClusterNamespace set context audit info via namespapce

func (*DefaultAuditInstance) WebsocketAuditFunc

func (audit *DefaultAuditInstance) WebsocketAuditFunc(username string, parents []cache.CommonResourceIface, ip string, proxyobj *ProxyObject) func(cmd string)

type ProxyObject

type ProxyObject struct {
	NamespacedScoped bool
	Cluster          string
	Namespace        string
	Name             string
	Group            string
	Version          string
	Resource         string
	Action           string
}

func (*ProxyObject) InNamespace

func (p *ProxyObject) InNamespace() bool

Jump to

Keyboard shortcuts

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