55 lines
1.5 KiB
Go
55 lines
1.5 KiB
Go
package system
|
|
|
|
import "strings"
|
|
|
|
// IgnoredAPI describes an endpoint excluded from the generated root policy.
|
|
// It deliberately has no GORM tags so the system module can be reused by
|
|
// bootstrap and migration code without exposing data-layer PO types.
|
|
type IgnoredAPI struct {
|
|
Method string
|
|
Path string
|
|
}
|
|
|
|
// AdminMenu describes a menu entry contributed by a module. ParentName is
|
|
// resolved by the system persistence layer so feature modules do not need to
|
|
// know the menu PO shape.
|
|
type AdminMenu struct {
|
|
Name string
|
|
Path string
|
|
ParentName string
|
|
Component string
|
|
Title string
|
|
Icon string
|
|
Sort int
|
|
}
|
|
|
|
type AdminAPI struct {
|
|
Path string
|
|
Method string
|
|
APIGroup string
|
|
Description string
|
|
}
|
|
|
|
type AdminSurface struct {
|
|
Menus []AdminMenu
|
|
APIs []AdminAPI
|
|
}
|
|
|
|
func DefaultIgnoredAPIs(staticPath string) []IgnoredAPI {
|
|
staticRoute := "/" + strings.Trim(staticPath, "/") + "/*filepath"
|
|
return []IgnoredAPI{
|
|
{Method: "GET", Path: "/api/freshCasbin"},
|
|
{Method: "GET", Path: "/health"},
|
|
{Method: "GET", Path: "/swagger/*any"},
|
|
{Method: "GET", Path: staticRoute},
|
|
{Method: "HEAD", Path: staticRoute},
|
|
{Method: "POST", Path: "/system/reloadSystem"},
|
|
{Method: "POST", Path: "/base/login"},
|
|
{Method: "POST", Path: "/base/captcha"},
|
|
{Method: "POST", Path: "/init/initdb"},
|
|
{Method: "POST", Path: "/init/checkdb"},
|
|
{Method: "GET", Path: "/info/getInfoDataSource"},
|
|
{Method: "GET", Path: "/info/getInfoPublic"},
|
|
}
|
|
}
|