Improve getObject() for "/api/get-policies"

This commit is contained in:
Yang Luo 2024-03-16 21:42:00 +08:00
parent 01a5958307
commit fd0bcd9a17

View File

@ -66,10 +66,18 @@ func getObject(ctx *context.Context) (string, string) {
path := ctx.Request.URL.Path path := ctx.Request.URL.Path
if method == http.MethodGet { if method == http.MethodGet {
if ctx.Request.URL.Path == "/api/get-policies" && ctx.Input.Query("id") == "/" { if ctx.Request.URL.Path == "/api/get-policies" {
adapterId := ctx.Input.Query("adapterId") if ctx.Input.Query("id") == "/" {
if adapterId != "" { adapterId := ctx.Input.Query("adapterId")
return util.GetOwnerAndNameFromIdNoCheck(adapterId) if adapterId != "" {
return util.GetOwnerAndNameFromIdNoCheck(adapterId)
}
} else {
// query == "?id=built-in/admin"
id := ctx.Input.Query("id")
if id != "" {
return util.GetOwnerAndNameFromIdNoCheck(id)
}
} }
} }