From e4a98a3e803b7fd677c89624e21c1f3700d7a3c8 Mon Sep 17 00:00:00 2001 From: Alexandr Dubovikov Date: Tue, 7 Jan 2025 12:46:21 +0100 Subject: [PATCH] Revert "Fix code scanning alert no. 10: Database query built from user-controlled sources" --- data/service/userSettings.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data/service/userSettings.go b/data/service/userSettings.go index 9e038316..cb750edb 100644 --- a/data/service/userSettings.go +++ b/data/service/userSettings.go @@ -177,7 +177,7 @@ func (ss *UserSettingsService) Get(userObject *model.TableUserSettings, UserName if err := ss.Session.Debug(). Table("user_settings"). - Where("guid = ? AND username = ?", userObject.GUID, UserName).Find(&data).Error; err != nil { + Where(sqlWhere).Find(&data).Error; err != nil { return data, err } return data, nil @@ -197,7 +197,7 @@ func (ss *UserSettingsService) Delete(userObject *model.TableUserSettings, UserN if err := ss.Session.Debug(). Table("user_settings"). - Where("guid = ? AND username = ?", userObject.GUID, UserName). + Where(sqlWhere). Delete(model.TableUserSettings{}).Error; err != nil { return err } @@ -220,7 +220,7 @@ func (ss *UserSettingsService) Update(userObject *model.TableUserSettings, UserN Table("user_settings"). Debug(). Model(&model.TableUserSettings{}). - Where("guid = ? AND username = ?", userObject.GUID, UserName).Update(userObject).Error; err != nil { + Where(sqlWhere).Update(userObject).Error; err != nil { return err } return nil