[feat] Controller AuthDB 约束
This commit is contained in:
parent
05f7b872c7
commit
a8084aee8c
@ -434,3 +434,20 @@ func (this Resource) onUserEvent(builder *db.Builder, user contracts.User) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func NewVirtualResource(pRes Resource, code, name, sql string, fields []ResField) contracts.Resource {
|
||||
return &Resource{
|
||||
Uuid: code,
|
||||
PUuid: pRes.Uuid,
|
||||
Code: code,
|
||||
Name: name,
|
||||
IsResVirtual: true,
|
||||
Table: sql,
|
||||
Namespace: pRes.Namespace,
|
||||
Workspace: pRes.Workspace,
|
||||
IsHistoryRecord: false,
|
||||
HistoryCacheMax: 0,
|
||||
Fields: fields,
|
||||
Roles: nil,
|
||||
}
|
||||
}
|
||||
|
@ -17,18 +17,26 @@ type Controller interface {
|
||||
|
||||
type HttpController interface {
|
||||
Controller
|
||||
|
||||
// 获取用户信息
|
||||
User() User
|
||||
|
||||
// 获取请求信息
|
||||
Request() *http.Request
|
||||
|
||||
// 请求处理
|
||||
Execute(GlobalParams) any
|
||||
|
||||
// 路由信息
|
||||
Route() Route
|
||||
|
||||
// 内部调用
|
||||
Call(code string, params map[string]any, category ...RouteCategory) (HttpResponse, error)
|
||||
// 内部调用
|
||||
// Invoke()
|
||||
|
||||
// 数据库权限
|
||||
AuthDB() ResAuthDB
|
||||
}
|
||||
|
||||
type WsController interface {
|
||||
@ -92,6 +100,10 @@ func (HttpBaseController) Execute(params GlobalParams) any {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (HttpBaseController) AuthDB() ResAuthDB {
|
||||
return ResAuthOn
|
||||
}
|
||||
|
||||
func (WsBaseController) ExecuteWS(params GlobalParams) error {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user