后端: - 种子数据:超级管理员(admin/admin123)、super_admin 角色、22 条菜单(含按钮权限码)、角色绑定 - admin_menu 扩展 icon/component/hidden 字段(003_schema_ext.sql),手动补齐 entity/do/table - auth 扩展:/auth/info、/auth/codes(仅登录),路由拆分公开/Profile/受保护三组 - 菜单路由:/menu/routes 返回 vben backend 动态路由树(按角色过滤、排序) - RBAC 管理:/admins、/roles、/menus CRUD(含角色绑定、重置密码、菜单授权) - 日志监控:/log/files、/log/tail(尾部读取+关键词过滤+路径穿越防护) - 安全加固:接口鉴权改为「方法+路径→权限码」自动映射,杜绝任意权限码越权 - 修复:gf v2.10.2 不自动替换→cmd 注入;MySQL driver 需显式引入 contrib - 全链路冒烟测试通过(含越权拒绝 30003)
36 lines
1.1 KiB
Go
36 lines
1.1 KiB
Go
package v1
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// LogFile describes one server log file.
|
|
type LogFile struct {
|
|
Name string `json:"name"` // file name
|
|
Path string `json:"path"` // path relative to the log dir
|
|
Size int64 `json:"size"` // bytes
|
|
ModTime string `json:"modTime"` // 2006-01-02 15:04:05
|
|
}
|
|
|
|
// LogFilesReq lists the server log files.
|
|
type LogFilesReq struct {
|
|
g.Meta `path:"/log/files" method:"get" tags:"Admin/Log" summary:"List server log files"`
|
|
}
|
|
|
|
// LogFilesRes is the response of LogFilesReq.
|
|
type LogFilesRes struct {
|
|
Dir string `json:"dir"`
|
|
Files []*LogFile `json:"files"`
|
|
}
|
|
|
|
// LogTailReq reads the tail of a log file with optional keyword filter.
|
|
type LogTailReq struct {
|
|
g.Meta `path:"/log/tail" method:"get" tags:"Admin/Log" summary:"Tail a server log file"`
|
|
File string `json:"file" v:"required#file required"` // relative to the log dir; path traversal is rejected
|
|
Lines int `json:"lines" d:"200" v:"min:1|max:2000"`
|
|
Keyword string `json:"keyword"` // substring filter
|
|
}
|
|
|
|
// LogTailRes is the response of LogTailReq.
|
|
type LogTailRes struct {
|
|
Lines []string `json:"lines"`
|
|
}
|