Commit aaaca527 authored by Daniele Venzano's avatar Daniele Venzano

Implement role commands in admin commandline tool

parent bdee5214
......@@ -3,7 +3,7 @@ requests>=2.9.1
docker>=2.1.0
tornado>=4.3
humanfriendly
psycopg2>=2.6.1
psycopg2-binary>=2.6.1
pyzmq>=15.2.0
typing
python-consul
......
......@@ -18,7 +18,6 @@
import tornado.escape
from zoe_api.rest_api.request_handler import ZoeAPIRequestHandler
import zoe_api.exceptions
class ExecutionAPI(ZoeAPIRequestHandler):
......
......@@ -84,12 +84,12 @@ class QuotaCollectionAPI(ZoeAPIRequestHandler):
filters = [
('name', str)
]
for filter in filters:
if filter[0] in self.request.arguments:
if filter[1] == str:
filter_dict[filter[0]] = self.request.arguments[filter[0]][0].decode('utf-8')
for filt in filters:
if filt[0] in self.request.arguments:
if filt[1] == str:
filter_dict[filt[0]] = self.request.arguments[filt[0]][0].decode('utf-8')
else:
filter_dict[filter[0]] = filter[1](self.request.arguments[filter[0]][0])
filter_dict[filt[0]] = filt[1](self.request.arguments[filt[0]][0])
try:
quota = self.api_endpoint.quota_list(self.current_user, **filter_dict)
......
......@@ -84,12 +84,12 @@ class RoleCollectionAPI(ZoeAPIRequestHandler):
filters = [
('name', str)
]
for filter in filters:
if filter[0] in self.request.arguments:
if filter[1] == str:
filter_dict[filter[0]] = self.request.arguments[filter[0]][0].decode('utf-8')
for filt in filters:
if filt[0] in self.request.arguments:
if filt[1] == str:
filter_dict[filt[0]] = self.request.arguments[filt[0]][0].decode('utf-8')
else:
filter_dict[filter[0]] = filter[1](self.request.arguments[filter[0]][0])
filter_dict[filt[0]] = filt[1](self.request.arguments[filt[0]][0])
try:
role = self.api_endpoint.role_list(self.current_user, **filter_dict)
......
......@@ -98,12 +98,12 @@ class UserCollectionAPI(ZoeAPIRequestHandler):
('role_id', int),
('quota_id', int)
]
for filter in filters:
if filter[0] in self.request.arguments:
if filter[1] == str:
filter_dict[filter[0]] = self.request.arguments[filter[0]][0].decode('utf-8')
for filt in filters:
if filt[0] in self.request.arguments:
if filt[1] == str:
filter_dict[filt[0]] = self.request.arguments[filt[0]][0].decode('utf-8')
else:
filter_dict[filter[0]] = filter[1](self.request.arguments[filter[0]][0])
filter_dict[filt[0]] = filt[1](self.request.arguments[filt[0]][0])
try:
users = self.api_endpoint.user_list(self.current_user, **filter_dict)
......
......@@ -17,7 +17,6 @@
import tornado.escape
import zoe_api.exceptions
from zoe_api.rest_api.request_handler import ZoeAPIRequestHandler
......
......@@ -194,6 +194,7 @@ def quota_update_cmd(api: ZoeAPI, args):
def role_ls_cmd(api: ZoeAPI, args):
"""List available roles."""
def b2t(val):
"""Boolean to text."""
if val:
return "Yes"
else:
......@@ -211,6 +212,7 @@ def role_ls_cmd(api: ZoeAPI, args):
def role_get_cmd(api: ZoeAPI, args):
"""Get a role by its ID."""
def b2t(val):
"""Boolean to text."""
if val:
return "Yes"
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment