Fix get-all-objects API 403 issue

This commit is contained in:
Yang Luo
2023-12-15 21:30:38 +08:00
parent b31a317585
commit 468ceb6b71
2 changed files with 6 additions and 0 deletions

View File

@ -271,6 +271,9 @@ func getRolesByUserInternal(userId string) ([]*Role, error) {
if err != nil {
return roles, err
}
if user == nil {
return nil, fmt.Errorf("The user: %s doesn't exist", userId)
}
query := ormer.Engine.Alias("r").Where("r.users like ?", fmt.Sprintf("%%%s%%", userId))
for _, group := range user.Groups {