Skip to content

Commit

Permalink
Merge pull request #70 from gisaia/fix/createorg
Browse files Browse the repository at this point in the history
fix create org
  • Loading branch information
sylvaingaudan authored Feb 21, 2025
2 parents 18aead6 + 9a5bb4c commit 0048fba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 5 additions & 5 deletions arlas/cli/org.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create_organisation(organisation: str = typer.Argument(default="", help="Org
if organisation:
print(Service.create_organisation(config, organisation).get("id"))
else:
print(Service.create_organisation_from_user_domain(config, organisation).get("id"))
print(Service.create_organisation_from_user_domain(config).get("id"))


@org.command(help="Delete the organisation", name="delete", epilog=variables["help_epilog"])
Expand Down 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
10 changes: 9 additions & 1 deletion arlas/cli/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def create_organisation(arlas: str, org: str):
return Service.__arlas__(arlas, "/".join(["organisations", org]), post="{}", service=Services.iam)

@staticmethod
def create_organisation_from_user_domain(arlas: str, org: str):
def create_organisation_from_user_domain(arlas: str):
return Service.__arlas__(arlas, "organisations", post="{}", service=Services.iam)

@staticmethod
Expand Down 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 0048fba

Please sign in to comment.