Skip to content

Commit

Permalink
fix add remove group to user
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvaingaudan committed Feb 21, 2025
1 parent c0f6cae commit 9a5bb4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arlas/cli/org.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ def add_user_to_group(org_id: str = typer.Argument(help="Organisation's identifi
user_id: str = typer.Argument(help="User identifier"),
group_id: str = typer.Argument(help="Group identifier")):
config = variables["arlas"]
print(Service.add_permission_to_group_in_organisation(config, org_id, user_id, group_id))
print(Service.add_user_to_organisation_group(config, org_id, user_id, group_id))


@org.command(help="Remove a user from a group within the organisation", name="delete_user_from_group", epilog=variables["help_epilog"])
def delete_user_from_group(org_id: str = typer.Argument(help="Organisation's identifier"),
@org.command(help="Remove a user from a group within the organisation", name="remove_user_from_group", epilog=variables["help_epilog"])
def remove_user_from_group(org_id: str = typer.Argument(help="Organisation's identifier"),
user_id: str = typer.Argument(help="User identifier"),
group_id: str = typer.Argument(help="Group identifier")):
config = variables["arlas"]
print(Service.delete_permission_from_group_in_organisation(config, org_id, user_id, group_id))
print(Service.remove_user_from_organisation_group(config, org_id, user_id, group_id))


@org.command(help="Add and return an new API Key with permissions associated to provided groups. Use the key id and key secret with the arlas-api-key-id and arlas-api-key-secret headers.", name="add-apikey",
Expand Down
8 changes: 8 additions & 0 deletions arlas/cli/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,14 @@ def add_permission_to_group_in_organisation(arlas: str, oid: str, role_id: str,
def delete_permission_from_group_in_organisation(arlas: str, oid: str, role_id: str, permission_id: str):
return Service.__arlas__(arlas, "/".join(["organisations", oid, "roles", role_id, "permissions", permission_id]), delete=True, service=Services.iam)

@staticmethod
def add_user_to_organisation_group(arlas: str, oid: str, uid: str, role_id: str):
return Service.__arlas__(arlas, "/".join(["organisations", oid, "users", uid, "roles", role_id]), post="{}", service=Services.iam)

@staticmethod
def remove_user_from_organisation_group(arlas: str, oid: str, uid: str, role_id: str):
return Service.__arlas__(arlas, "/".join(["organisations", oid, "users", uid, "roles", role_id]), delete=True, service=Services.iam)

@staticmethod
def add_role_in_organisation(arlas: str, oid: str, role_name: str, role_description: str):
return Service.__arlas__(arlas, "/".join(["organisations", oid, "roles"]), post=json.dumps({"name": role_name, "description": role_description}), service=Services.iam)
Expand Down

0 comments on commit 9a5bb4c

Please sign in to comment.