summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xeffitool20
1 files changed, 5 insertions, 15 deletions
diff --git a/effitool b/effitool
index 3634bd4..36a7fa7 100755
--- a/effitool
+++ b/effitool
@@ -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: