Skip to content

Commit

Permalink
Merge pull request #1345 from greenbone/del-perm-orph
Browse files Browse the repository at this point in the history
Account for -1 of orphans when deleting permission
  • Loading branch information
timopollmeier authored Nov 5, 2020
2 parents f46187a + 4c95896 commit efc4c55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Switch result filter column 'task' from task ID to name task name [#1317](https://github.com/greenbone/gvmd/pull/1317)
- Correct check of get_certificate_info return [#1318](https://github.com/greenbone/gvmd/pull/1318)
- Fix GMP doc text of `active` elem for notes and overrides [#1323](https://github.com/greenbone/gvmd/pull/1323)
- Account for -1 of orphans when deleting permission [#1345](https://github.com/greenbone/gvmd/pull/1345)
- Move feed object in trash checks to startup [#1325](https://github.com/greenbone/gvmd/pull/1325)
- Always check for 'All' when deleting selectors [#1342](https://github.com/greenbone/gvmd/pull/1342)
- Do not inherit settings from deleted users [#1328](https://github.com/greenbone/gvmd/pull/1328)
Expand Down
5 changes: 3 additions & 2 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -44381,7 +44381,8 @@ delete_permission (const char *permission_id, int ultimate)
cache_permissions_for_resource (resource_type, resource, NULL);

/* Update Reports cache */
if (resource_type && resource && strcmp (resource_type, "override") == 0)
if (resource_type && (resource > 0) && strcmp (resource_type, "override")
== 0)
{
reports = reports_for_override (resource);
}
Expand Down Expand Up @@ -56123,7 +56124,7 @@ cache_permissions_for_resource (const char *type, resource_t resource,
{
int free_users;

if (type == NULL || resource == 0)
if (type == NULL || resource == 0 || resource == -1)
return;

if (cache_users == NULL)
Expand Down

0 comments on commit efc4c55

Please sign in to comment.