8000 Add role_user_assignment and role_team_assignment modules by Tompage1994 · Pull Request #408 · ansible/event-driven-ansible · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add role_user_assignment and role_team_assignment modules #408

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

Tompage1994
Copy link

resolves #407

Adds the modules to control the relevant endpoints. More info in the issue.

Signed-off-by: tompage1994@hotmail.co.uk <tpage@redhat.com>
@Tompage1994
Copy link
Author

I know that the testing for role_team_assignment is not going to work because it requires a team to exist and I'm not entirely sure how I'd get that.

I'll also take the action following release of this code to add the functionality to infra.aap_configuration

Signed-off-by: tompage1994@hotmail.co.uk <tpage@redhat.com>
Signed-off-by: tompage1994@hotmail.co.uk <tpage@redhat.com>
type: str
extends_documentation_fragment:
- ansible.eda.eda_controller.auths
"""
Copy link
Member

Choose a reason for hiding this comment

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

Can you please sanitize the documentation section and change it to two-space tab everywhere?

type: str
extends_documentation_fragment:
- ansible.eda.eda_controller.auths
"""
Copy link
Member

Choose a reason for hiding this comment

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

Same comment about using two-space tabs. Check above.

author: "Tom Page (@Tompage1994)"
short_description: Gives a team permission to a resource or an organization.
description:
- Use this endpoint to give a team permission to a resource or an organization.
Copy link
Member

Choose a reason for hiding this comment

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

I would like to suggest staying within the standard description of other modules and starting with something like

This module allows the user to give...

object_id:
description:
- Primary key of the object this assignment applies to.
required: False
Copy link
Member

Choose a reason for hiding this comment

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

required: False is implied by default. It can be removed here and elsewhere.


EXAMPLES = """
- name: Give Administrators organization admin role for org 1
ansible.platform.role_team_assignment:
Copy link
Member

Choose a reason for hiding this comment

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

Since this change is for the EDA collection, can you please change the example here to ansible.eda.role_team_assignment?

def main() -> None:
# Any additional arguments that are not fields of the item can be added here
argument_spec = dict(
team=dict(required=False, type="str"),
Copy link
Member

Choose a reason for hiding this comment

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

required=False is also implied. It can be removed.

Comment on lines 118 to 121
role_definition = controller.get_exactly_one(
"role_definitions", name=role_definition_str
)
team = controller.get_exactly_one("teams", name=team_param)
Copy link
Member

Choose a reason for hiding this comment

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

Can you put this under a try/except clause?

Comment on lines 118 to 121
role_definition = controller.get_exactly_one(
"role_definitions", name=role_definition_str
)
user = controller.get_exactly_one("users", name=user_param)
Copy link
Member

Choose a reason for hiding this comment

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

Please also put this under a try/except.

Copy link
Member

Choose a reason for hiding this comment

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

Missing an intermediate tasks directory. It should be included under role_team_assignment/tasks/main.yml to be picked up by tox.

Copy link
Member

Choose a reason for hiding this comment

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

Missing an intermediate tasks directory. It should be included under role_user_assignment/tasks/main.yml to be picked up by tox.

@Tompage1994
Copy link
Author

ok, fixed as requested.

I've now taken the testing as far as I can. It's failing because the team doesn't exist. Not sure how I would be able to seed in a team as this would need to make use of ansible.platform.team module.

Any ideas how this could be progressed?

@Dostonbek1
Copy link
Member

ok, fixed as requested.

I've now taken the testing as far as I can. It's failing because the team doesn't exist. Not sure how I would be able to seed in a team as this would need to make use of ansible.platform.team module.

Any ideas how this could be progressed?

Teams can be created in EDA through /v1/teams/ endpoint but looks like this collection doesn't have a module for it. @ansible/eda-maintainers Would we preferably want to have this module to support teams endpoint? Not sure if there are any restrictions from the platform regarding that. Or can the team module from platform collection be re-used for EDA as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Create role_user_assignment and role_team_assignment modules
7 participants
0