fix: search usergrants if no resourceowner query (#2579)

This commit is contained in:
Fabi 2021-10-27 09:28:44 +02:00 committed by GitHub
parent a4127278e7
commit 802fbf175b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,9 +56,9 @@ func SearchUserGrants(db *gorm.DB, table string, req *grant_model.UserGrantSearc
}
}
if withGranted {
if orgID != "" && withGranted {
db = db.Where("resource_owner = ? OR project_owner = ?", orgID, orgID)
} else {
} else if orgID != "" {
db = db.Where("resource_owner = ?", orgID)
}
query := repository.PrepareSearchQuery(table, model.UserGrantSearchRequest{Limit: req.Limit, Offset: req.Offset, Queries: req.Queries})