Fix updating saved filters
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2020-09-26 13:43:32 +02:00
parent ccc604f768
commit 650f57f2af
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 4 additions and 2 deletions

View File

@ -78,7 +78,7 @@ func AssertDBExists(t *testing.T, table string, values map[string]interface{}, c
var exists bool
var err error
v := make(map[string]interface{})
// Postgres sometimes needs to build raw sql. Because is won't always need to do this and this isn't fun, it's a flag.
// Postgres sometimes needs to build raw sql. Because it won't always need to do this and this isn't fun, it's a flag.
if custom {
//#nosec
sql := "SELECT * FROM " + table + " WHERE "

View File

@ -31,7 +31,9 @@ func (s *SavedFilter) CanDelete(auth web.Auth) (bool, error) {
// CanUpdate checks if a user has the right to update a saved filter
func (s *SavedFilter) CanUpdate(auth web.Auth) (bool, error) {
return s.canDoFilter(auth)
// A normal check would replace the passed struct which in our case would override the values we want to update.
sf := &SavedFilter{ID: s.ID}
return sf.canDoFilter(auth)
}
// CanCreate checks if a user has the right to update a saved filter