Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return only one setting when setting_id is given (master) #780

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 7 additions & 3 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -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')"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to not do ACL stuff manually in here, but at least it's consistent with the other branch of the 'if'.

" 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,
Expand Down