mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 01:57:13 +02:00
Add orgname filter for access list (#3564)
* add orgname filter for access list * fix * fix namings
This commit is contained in:
@ -92,5 +92,7 @@ class RegistryClient(RESTClient):
|
|||||||
"delete", "/v3/resources/%s/access" % urn, data={"client": client},
|
"delete", "/v3/resources/%s/access" % urn, data={"client": client},
|
||||||
)
|
)
|
||||||
|
|
||||||
def list_own_resources(self):
|
def list_resources(self, owner):
|
||||||
return self.send_auth_request("get", "/v3/resources",)
|
return self.send_auth_request(
|
||||||
|
"get", "/v3/resources", params={"owner": owner} if owner else None
|
||||||
|
)
|
||||||
|
@ -109,11 +109,12 @@ def access_revoke(client, urn, urn_type):
|
|||||||
|
|
||||||
|
|
||||||
@cli.command("list", short_help="List resources")
|
@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("--urn-type", type=click.Choice(["urn:reg:pkg"]), default="urn:reg:pkg")
|
||||||
@click.option("--json-output", is_flag=True)
|
@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()
|
reg_client = RegistryClient()
|
||||||
resources = reg_client.list_own_resources()
|
resources = reg_client.list_resources(owner=owner)
|
||||||
if json_output:
|
if json_output:
|
||||||
return click.echo(json.dumps(resources))
|
return click.echo(json.dumps(resources))
|
||||||
if not resources:
|
if not resources:
|
||||||
|
Reference in New Issue
Block a user