feat: use role ID to search in GetPermissionsAndRolesByUser() (#2170)

This commit is contained in:
Yaodong Yu 2023-08-02 20:58:06 +08:00 committed by GitHub
parent c6f301ff9e
commit a05ca3af24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -290,7 +290,7 @@ func GetPermissionsAndRolesByUser(userId string) ([]*Permission, []*Role, error)
for _, role := range roles {
perms := []*Permission{}
err := ormer.Engine.Where("roles like ?", "%"+role.Name+"\"%").Find(&perms)
err := ormer.Engine.Where("roles like ?", "%"+role.GetId()+"\"%").Find(&perms)
if err != nil {
return nil, nil, err
}