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

Why modify_permission doesn't work? #1047

Open
IIMars opened this issue Jul 11, 2023 · 0 comments
Open

Why modify_permission doesn't work? #1047

IIMars opened this issue Jul 11, 2023 · 0 comments

Comments

@IIMars
Copy link

IIMars commented Jul 11, 2023

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant