kra-oa/internal/data/repository/bootstrap.go

30 lines
984 B
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
}
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"},
}
}