diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-03-16 15:15:56 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-03-16 15:15:56 +0200 |
commit | 100e9fa3565600f55df792f4c6c6efdb370bc3ab (patch) | |
tree | 19e2886d8f1aee2a66b6c3bb974529fce0853c41 /effitool | |
parent | feddd854c095f9096f4a773c1738b1bc276ccce7 (diff) | |
download | effitool-100e9fa3565600f55df792f4c6c6efdb370bc3ab.tar.gz |
Add: show-client subcommand
Also, list-clients now only shows the names.
Diffstat (limited to 'effitool')
-rwxr-xr-x | effitool | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -242,10 +242,18 @@ class Tool: token = self.get_admin_token(server) api = HTTPAPI(server['url']) obj = api.get_list(token, '/clients') - for name in obj.get('resources', []): - client = api.get_json(token, '/clients/{}'.format(name)) - del client['hashed_secret'] - print(json.dumps(client, indent=4)) + for name in sorted(obj.get('resources', [])): + print(name) + + def show_clients(self, args): + server = self.get_chosen_server(args) + token = self.get_admin_token(server) + api = HTTPAPI(server['url']) + obj = api.get_list(token, '/clients') + client = api.get_json(token, '/clients/{}'.format(args['client-name'])) + del client['hashed_secret'] + for scope in client.get('allowed_scopes', []): + print(scope) def process_args(config): @@ -259,6 +267,9 @@ def process_args(config): ('--client-secret', {'required':True}), ]), ('list-clients', tool.list_clients, []), + ('show-client', tool.show_clients, [ + ('client-name', {}), + ]), ] p = argparse.ArgumentParser() |