fix: query correct column (#991)

* fix(management): search user grants with granted

* fix(auth): handle user grant project owner

* fix: grantowner to resourceowner

* fix: generate mock

* fix: mig

* fix: query correct columns

* fix: remove new line
This commit is contained in:
Silvan 2020-11-19 15:21:22 +01:00 committed by GitHub
parent 93e941a475
commit 9c603d9b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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