Fix updating saved filters
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
ccc604f768
commit
650f57f2af
|
@ -78,7 +78,7 @@ func AssertDBExists(t *testing.T, table string, values map[string]interface{}, c
|
||||||
var exists bool
|
var exists bool
|
||||||
var err error
|
var err error
|
||||||
v := make(map[string]interface{})
|
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 {
|
if custom {
|
||||||
//#nosec
|
//#nosec
|
||||||
sql := "SELECT * FROM " + table + " WHERE "
|
sql := "SELECT * FROM " + table + " WHERE "
|
||||||
|
|
|
@ -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
|
// CanUpdate checks if a user has the right to update a saved filter
|
||||||
func (s *SavedFilter) CanUpdate(auth web.Auth) (bool, error) {
|
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
|
// CanCreate checks if a user has the right to update a saved filter
|
||||||
|
|
Loading…
Reference in New Issue