Documentation ¶
Index ¶
- Constants
- func GetAuditData(c *gin.Context) map[string]string
- func GetExtraAuditData(c *gin.Context) (string, map[string]string)
- type AuditInterface
- type DefaultAuditInstance
- func (audit *DefaultAuditInstance) AuditProxyFunc(c *gin.Context, proxyobj *ProxyObject)
- func (audit *DefaultAuditInstance) Consumer(ctx context.Context) error
- func (audit *DefaultAuditInstance) Log(username, module, tenant, operation, name string, labels map[string]string, ...)
- func (audit *DefaultAuditInstance) LogIt(c *gin.Context, t time.Time, raw gin.H)
- func (audit *DefaultAuditInstance) Middleware() func(c *gin.Context)
- func (audit *DefaultAuditInstance) SaveAuditLog(c *gin.Context)
- func (audit *DefaultAuditInstance) SetAuditData(c *gin.Context, action, module, name string)
- func (audit *DefaultAuditInstance) SetExtraAuditData(c *gin.Context, kind string, uid uint)
- func (audit *DefaultAuditInstance) SetExtraAuditDataByClusterNamespace(c *gin.Context, cluster, namespace string)
- func (audit *DefaultAuditInstance) WebsocketAuditFunc(username string, parents []cache.CommonResourceIface, ip string, ...) func(cmd string)
- type ProxyObject
Constants ¶
View Source
const ( AuditMark = "needAudit" AuditAction = "auditAction" )
View Source
const ( AuditSubjectKey = "audit_subject" AuditExtraDataKey = "audit_extra_datas" )
Variables ¶
This section is empty.
Functions ¶
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) 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 设置上下文的审计数据
func (*DefaultAuditInstance) SetExtraAuditData ¶
func (audit *DefaultAuditInstance) SetExtraAuditData(c *gin.Context, kind string, uid uint)
SetExtraAuditData 设置上下文的审计数据 的系统环境信息(租户,项目,环境)
func (*DefaultAuditInstance) SetExtraAuditDataByClusterNamespace ¶
func (audit *DefaultAuditInstance) SetExtraAuditDataByClusterNamespace(c *gin.Context, cluster, namespace string)
SetExtraAuditDataByClusterNamespace 根据集群namesapce设置上下文的审计数据 的系统环境信息(租户,项目,环境)
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
Click to show internal directories.
Click to hide internal directories.