diff options
author | Lars Wirzenius <liw@liw.fi> | 2019-03-23 14:29:27 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2019-03-23 14:29:27 +0200 |
commit | 459f8112b25a42ca6390bda1d434d70d4f76e065 (patch) | |
tree | 70af1d1f1c473fa2e61cc3beb90756f83f7a0c80 | |
parent | 2a51eb3197507f40f51e50745094bd2645149c30 (diff) | |
download | effitool-459f8112b25a42ca6390bda1d434d70d4f76e065.tar.gz |
Change: use Session.deny_scopes
-rwxr-xr-x | effitool | 20 |
1 files changed, 5 insertions, 15 deletions
@@ -233,11 +233,10 @@ class Session: client['allowed_scopes'] = uniq(client.get('allowed_scopes', []) + scopes) self.update_client(client_id, client) - def deny_scopes(self, client_id, scopes): + def deny_scopes(self, client_id, denied): client = self.get_client(client_id) - old_scopes = client.get('allowed_scopes', []) - client['allowed_scopes'] = uniq( - s for s in old_scopes if s not in denied_scopes) + old = client.get('allowed_scopes', []) + client['allowed_scopes'] = uniq(s for s in old if s not in denied) self.update_client(client_id, client) def fetch_member(self, rid): @@ -345,17 +344,8 @@ class Tool: session.allow_scopes(args['client-name'], args['scope']) def deny_scope(self, args): - name = args['client-name'] - denied_scopes = args['scope'] - server = self.get_chosen_server(args) - token = self.get_admin_token(server) - api = HTTPAPI(server['url']) - path = '/clients/{}'.format(name) - client = api.get_json(token, path) - old_scopes = client.get('allowed_scopes', []) - client['allowed_scopes'] = uniq( - s for s in old_scopes if s not in denied_scopes) - api.put_json(token, path, client) + session = self.get_session(args) + session.deny_scopes(args['client-name'], args['scope']) def add_member(self, args): with open(args['filename']) as f: |