mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Add GetOwnerAndNameFromIdNoCheck() to fix bug.
This commit is contained in:
parent
ea8971ff29
commit
90ec8ec787
@ -57,17 +57,17 @@ func getResource(owner string, name string) *Resource {
|
||||
if existed {
|
||||
return &resource
|
||||
}
|
||||
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetResource(id string) *Resource {
|
||||
owner, name := util.GetOwnerAndNameFromId(id)
|
||||
owner, name := util.GetOwnerAndNameFromIdNoCheck(id)
|
||||
return getResource(owner, name)
|
||||
}
|
||||
|
||||
func UpdateResource(id string, resource *Resource) bool {
|
||||
owner, name := util.GetOwnerAndNameFromId(id)
|
||||
owner, name := util.GetOwnerAndNameFromIdNoCheck(id)
|
||||
if getResource(owner, name) == nil {
|
||||
return false
|
||||
}
|
||||
|
@ -43,6 +43,11 @@ func GetOwnerAndNameFromId(id string) (string, string) {
|
||||
return tokens[0], tokens[1]
|
||||
}
|
||||
|
||||
func GetOwnerAndNameFromIdNoCheck(id string) (string, string) {
|
||||
tokens := strings.SplitN(id, "/", 2)
|
||||
return tokens[0], tokens[1]
|
||||
}
|
||||
|
||||
func GenerateId() string {
|
||||
return uuid.NewString()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user