comptroller

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: MIT Imports: 11 Imported by: 0

README

审计中间件

ws.Route(ws.GET("").To(h.QueryUser).
    Doc("用户列表查询").
    Metadata(restfulspec.KeyOpenAPITags, tags).
    // 这个开关怎么生效
    // 中间件需求读取接口的描述信息,来决定是否需要认证
    Metadata(permission.Auth(true)).
    Metadata(permission.Permission(true)).
    Metadata(permission.Resource("user")).
    Metadata(permission.Action("list")).
    Metadata(comptroller.Enable(true)).
    Param(restful.QueryParameter("page_size", "分页大小").DataType("integer")).
    Param(restful.QueryParameter("page_number", "页码").DataType("integer")).
    Writes(Set{}).
    Returns(200, "OK", Set{}))

Documentation

Index

Constants

View Source
const (
	// MetaAuditKey 定义开启审计的元数据键
	MetaAuditKey = "audit"
)

Variables

This section is empty.

Functions

func Enable

func Enable(v bool) (string, bool)

Types

type EventSender

type EventSender struct {
	ioc.ObjectImpl

	Topic string `json:"topic" toml:"topic" yaml:"topic" env:"TOPIC"` // 当前消费者配置的 topic
	// contains filtered or unexported fields
}

func (*EventSender) Init

func (sender *EventSender) Init() error

func (*EventSender) Name

func (sender *EventSender) Name() string

func (*EventSender) SendEvent

func (sender *EventSender) SendEvent() restful.FilterFunction

SendEvent 审计日志的发送逻辑

type MetaData

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

func NewMetaData

func NewMetaData(data map[string]any) *MetaData

func (*MetaData) GetBool

func (m *MetaData) GetBool(key string) bool

func (*MetaData) GetString

func (m *MetaData) GetString(key string) string

Jump to

Keyboard shortcuts

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