admin section in left sidebar; project switch in navbar
[osm/LW-UI.git] / lib / osm / osmclient / clientv2.py
index 536ef65..5e4f390 100644 (file)
@@ -110,6 +110,22 @@ class Client(object):
             result['data'] = Util.json_loads_byteified(r.text)
         return result
 
+    def get_user_info(self, token, id):
+        result = {'error': True, 'data': ''}
+        headers = {"Content-Type": "application/yaml", "accept": "application/json",
+                   'Authorization': 'Bearer {}'.format(token['id'])}
+        _url = "{0}/admin/v1/users/{1}".format(self._base_path, id)
+        try:
+            r = requests.get(_url, params=None, verify=False, stream=True, headers=headers)
+        except Exception as e:
+            log.exception(e)
+            result['data'] = str(e)
+            return result
+        if r.status_code == requests.codes.ok:
+            result['error'] = False
+        result['data'] = Util.json_loads_byteified(r.text)
+        return result
+
     def project_list(self, token):
         result = {'error': True, 'data': ''}
         headers = {"Content-Type": "application/yaml", "accept": "application/json",
@@ -142,6 +158,7 @@ class Client(object):
         if r.status_code == requests.codes.ok:
             result['error'] = False
         result['data'] = Util.json_loads_byteified(r.text)
+        return result
 
     def project_create(self, token, project_data):