diff --git a/CHANGELOG.md b/CHANGELOG.md index 92b5da9f2..78173a5bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -77,6 +77,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix issues importing results or getting them from slaves if they contain "%s" [#723](https://github.com/greenbone/gvmd/pull/723) - Fix sorting by numeric filter columns [#751](https://github.com/greenbone/gvmd/pull/751) - Fix array index error when modifying roles and groups [#762](https://github.com/greenbone/gvmd/pull/762) +- Make get_settings return only one setting when setting_id is given [#780](https://github.com/greenbone/gvmd/pull/780) ### Removed - The handling of NVT updates via OTP has been removed. [#575](https://github.com/greenbone/gvmd/pull/575) diff --git a/src/manage_sql.c b/src/manage_sql.c index cbec1f8b1..f758274b5 100644 --- a/src/manage_sql.c +++ b/src/manage_sql.c @@ -58624,11 +58624,15 @@ init_setting_iterator (iterator_t *iterator, const char *uuid, "SELECT %s" " FROM settings" " WHERE uuid = '%s'" - " AND " ACL_GLOBAL_OR_USER_OWNS () - /* Force the user's setting to come before the default. */ - " ORDER BY coalesce (owner, 0) DESC;", + " AND (owner = (SELECT id FROM users WHERE uuid = '%s')" + " OR (owner IS NULL" + " AND uuid" + " NOT IN (SELECT uuid FROM settings" + " WHERE owner = (SELECT id FROM users" + " WHERE uuid = '%s'))))", columns, quoted_uuid, + current_credentials.uuid, current_credentials.uuid); else init_iterator (iterator,