Add orgname filter for access list (#3564)

* add orgname filter for access list

* fix

* fix namings
This commit is contained in:
ShahRustam
2020-06-17 18:55:40 +03:00
committed by GitHub
parent 42e8ea29ff
commit e853d61e16
2 changed files with 7 additions and 4 deletions

View File

@ -92,5 +92,7 @@ class RegistryClient(RESTClient):
"delete", "/v3/resources/%s/access" % urn, data={"client": client},
)
def list_own_resources(self):
return self.send_auth_request("get", "/v3/resources",)
def list_resources(self, owner):
return self.send_auth_request(
"get", "/v3/resources", params={"owner": owner} if owner else None
)

View File

@ -109,11 +109,12 @@ def access_revoke(client, urn, urn_type):
@cli.command("list", short_help="List resources")
@click.argument("owner", required=False)
@click.option("--urn-type", type=click.Choice(["urn:reg:pkg"]), default="urn:reg:pkg")
@click.option("--json-output", is_flag=True)
def access_list(urn_type, json_output):
def access_list(owner, urn_type, json_output):
reg_client = RegistryClient()
resources = reg_client.list_own_resources()
resources = reg_client.list_resources(owner=owner)
if json_output:
return click.echo(json.dumps(resources))
if not resources: