Skip to content

Why modify_permission doesn't work? #1047

Description

@IIMars

Hello, I encountered some problems when I used python-gvm, so I would like to ask you for advice.
When I use modify_permission to modify an existing permission, it doesn't work as expected.

  1. When I passed in the permission_id and comment values, it did not successfully modify the comment corresponding to the permission, but reported an error: <modify_permission_response status="400" status_text="Error in SUBJECT">
    The code shows as below:
path = '/run/gvmd/gvmd.sock'
connection = UnixSocketConnection(path=path)
with Gmp(connection=connection) as gmp:
    gmp.authenticate('admin','199954')
    print(gmp.modify_permission(
        permission_id='d140d640-01f1-4c98-8fe8-616e8829e55d',             #The id of authenticate
        # name='authenticate',
        comment='010203040000',
        # resource_type=EntityType.SCAN_CONFIG,
        # resource_id='d21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663',
        # resource_type=None,
        # resource_id=None,
        # subject_id='c3de57e6-6678-4a06-9866-47e43321fa77',             #The id of an USER
        # subject_type=PermissionSubjectType.USER
    ))
  1. When I passed in the subject corresponding to the permission, it reported another error: "gvm.errors.GvmError: Remote closed the connection"
path = '/run/gvmd/gvmd.sock'
connection = UnixSocketConnection(path=path)
with Gmp(connection=connection) as gmp:
    gmp.authenticate('admin','199954')
    print(gmp.modify_permission(
        permission_id='d140d640-01f1-4c98-8fe8-616e8829e55d',             #The id of authenticate
        # name='authenticate',
        comment='010203040000',
        # resource_type=EntityType.SCAN_CONFIG,
        # resource_id='d21f6c81-2b88-4ac1-b7b4-a2a9f2ad4663',
        # resource_type=None,
        # resource_id=None,
        subject_id='c3de57e6-6678-4a06-9866-47e43321fa77',             #The id of an USER
        subject_type=PermissionSubjectType.USER
    ))
  1. Only when all the parameters are passed in can the modification be successful.But I don't know what parameter should be passed in those permissions don't have Resource.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions