summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xeffitool17
1 files changed, 8 insertions, 9 deletions
diff --git a/effitool b/effitool
index 9caf322..1954581 100755
--- a/effitool
+++ b/effitool
@@ -222,6 +222,12 @@ class Session:
def get_client(self, client_id):
return self._api.get_json(self._token, '/clients/{}'.format(client_id))
+ def allow_scopes(self, client_id, scopes):
+ path = '/clients/{}'.format(client_id)
+ client = self._api.get_json(self._token, path)
+ client['allowed_scopes'] = uniq(client.get('allowed_scopes', []) + scopes)
+ self._api.put_json(self._token, path, client)
+
def fetch_member(self, rid):
headers = {
'Muck-Id': rid,
@@ -323,15 +329,8 @@ class Tool:
print(scope)
def allow_scope(self, args):
- name = args['client-name']
- 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)
- client['allowed_scopes'] = uniq(client.get('allowed_scopes', []) + scopes)
- api.put_json(token, path, client)
+ session = self.get_session(args)
+ session.allow_scopes(args['client-name'], args['scope'])
def deny_scope(self, args):
name = args['client-name']