Skip to content

Commit

Permalink
Fix enum checks for compliance types
Browse files Browse the repository at this point in the history
The checks only recognize the enum variables as equal if the
values are compared explicitly.
  • Loading branch information
timopollmeier committed Dec 4, 2020
1 parent cf569f2 commit dd5f73c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gvm/protocols/gmpv9/gmpv9.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,9 @@ def create_permission(
)

_actual_resource_type = resource_type
if resource_type == EntityType.AUDIT:
if resource_type.value == EntityType.AUDIT.value:
_actual_resource_type = EntityType.TASK
elif resource_type == EntityType.POLICY:
elif resource_type.value == EntityType.POLICY.value:
_actual_resource_type = EntityType.SCAN_CONFIG

_xmlresource.add_element("type", _actual_resource_type.value)
Expand Down Expand Up @@ -541,9 +541,9 @@ def create_tag(
)

_actual_resource_type = resource_type
if resource_type == EntityType.AUDIT:
if resource_type.value == EntityType.AUDIT.value:
_actual_resource_type = EntityType.TASK
elif resource_type == EntityType.POLICY:
elif resource_type.value == EntityType.POLICY.value:
_actual_resource_type = EntityType.SCAN_CONFIG
_xmlresources.add_element("type", _actual_resource_type.value)

Expand Down Expand Up @@ -946,9 +946,9 @@ def modify_permission(
"resource", attrs={"id": resource_id}
)
_actual_resource_type = resource_type
if resource_type == EntityType.AUDIT:
if resource_type.value == EntityType.AUDIT.value:
_actual_resource_type = EntityType.TASK
elif resource_type == EntityType.POLICY:
elif resource_type.value == EntityType.POLICY.value:
_actual_resource_type = EntityType.SCAN_CONFIG
_xmlresource.add_element("type", _actual_resource_type.value)

Expand Down Expand Up @@ -1162,9 +1162,9 @@ def modify_tag(
arg_type=EntityType.__name__,
)
_actual_resource_type = resource_type
if resource_type == EntityType.AUDIT:
if resource_type.value == EntityType.AUDIT.value:
_actual_resource_type = EntityType.TASK
elif resource_type == EntityType.POLICY:
elif resource_type.value == EntityType.POLICY.value:
_actual_resource_type = EntityType.SCAN_CONFIG
_xmlresources.add_element("type", _actual_resource_type.value)

Expand Down

0 comments on commit dd5f73c

Please sign in to comment.