Fix id of "/api/get-resource" API

This commit is contained in:
Yang Luo
2023-07-23 11:33:48 +08:00
parent a6f803aff1
commit 09f40bb5ce
2 changed files with 6 additions and 1 deletions

View File

@ -16,6 +16,7 @@ package object
import (
"fmt"
"strings"
"github.com/casdoor/casdoor/util"
"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) {
if !strings.HasPrefix(name, "/") {
name = "/" + name
}
resource := Resource{Owner: owner, Name: name}
existed, err := adapter.Engine.Get(&resource)
if err != nil {