mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 20:50:19 +08:00
Fix id of "/api/get-resource" API
This commit is contained in:
@ -16,6 +16,7 @@ package object
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/casdoor/casdoor/util"
|
"github.com/casdoor/casdoor/util"
|
||||||
"github.com/xorm-io/core"
|
"github.com/xorm-io/core"
|
||||||
@ -76,6 +77,10 @@ func GetPaginationResources(owner, user string, offset, limit int, field, value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getResource(owner string, name string) (*Resource, error) {
|
func getResource(owner string, name string) (*Resource, error) {
|
||||||
|
if !strings.HasPrefix(name, "/") {
|
||||||
|
name = "/" + name
|
||||||
|
}
|
||||||
|
|
||||||
resource := Resource{Owner: owner, Name: name}
|
resource := Resource{Owner: owner, Name: name}
|
||||||
existed, err := adapter.Engine.Get(&resource)
|
existed, err := adapter.Engine.Get(&resource)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -156,7 +156,7 @@ func AuthzFilter(ctx *context.Context) {
|
|||||||
urlPath := getUrlPath(ctx.Request.URL.Path)
|
urlPath := getUrlPath(ctx.Request.URL.Path)
|
||||||
|
|
||||||
objOwner, objName := "", ""
|
objOwner, objName := "", ""
|
||||||
if urlPath != "/api/get-app-login" {
|
if urlPath != "/api/get-app-login" && urlPath != "/api/get-resource" {
|
||||||
objOwner, objName = getObject(ctx)
|
objOwner, objName = getObject(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user