mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 10:45:47 +08:00
Improve getObject() for "/api/get-policies"
This commit is contained in:
parent
01a5958307
commit
fd0bcd9a17
@ -66,11 +66,19 @@ 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" {
|
||||||
|
if ctx.Input.Query("id") == "/" {
|
||||||
adapterId := ctx.Input.Query("adapterId")
|
adapterId := ctx.Input.Query("adapterId")
|
||||||
if adapterId != "" {
|
if adapterId != "" {
|
||||||
return util.GetOwnerAndNameFromIdNoCheck(adapterId)
|
return util.GetOwnerAndNameFromIdNoCheck(adapterId)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// query == "?id=built-in/admin"
|
||||||
|
id := ctx.Input.Query("id")
|
||||||
|
if id != "" {
|
||||||
|
return util.GetOwnerAndNameFromIdNoCheck(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !(strings.HasPrefix(ctx.Request.URL.Path, "/api/get-") && strings.HasSuffix(ctx.Request.URL.Path, "s")) {
|
if !(strings.HasPrefix(ctx.Request.URL.Path, "/api/get-") && strings.HasSuffix(ctx.Request.URL.Path, "s")) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user