Skip to content
Snippets Groups Projects
Commit 1c0c4c9f authored by Tim Kreuzer's avatar Tim Kreuzer
Browse files

fix user usage

parent 0989abb5
No related branches found
No related tags found
No related merge requests found
...@@ -12,7 +12,7 @@ from .misc import NoXSRFCheckAPIHandler ...@@ -12,7 +12,7 @@ from .misc import NoXSRFCheckAPIHandler
class FHostnameAPIHandler(NoXSRFCheckAPIHandler): class FHostnameAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
self.write(jhub_hostname) self.write(jhub_hostname)
self.set_status(200) self.set_status(200)
...@@ -20,7 +20,7 @@ class FHostnameAPIHandler(NoXSRFCheckAPIHandler): ...@@ -20,7 +20,7 @@ class FHostnameAPIHandler(NoXSRFCheckAPIHandler):
class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler): class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
self.write(json.dumps(get_custom_config().get("systems", {}))) self.write(json.dumps(get_custom_config().get("systems", {})))
self.set_status(200) self.set_status(200)
...@@ -28,9 +28,9 @@ class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler): ...@@ -28,9 +28,9 @@ class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler):
class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler): class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_custom_config().get("mapSystems", {}))) self.write(json.dumps(get_custom_config().get("mapSystems", {})))
self.set_status(200) self.set_status(200)
...@@ -38,9 +38,9 @@ class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler): ...@@ -38,9 +38,9 @@ class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler):
class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler): class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_custom_config().get("mapPartitions", {}))) self.write(json.dumps(get_custom_config().get("mapPartitions", {})))
self.set_status(200) self.set_status(200)
...@@ -48,9 +48,9 @@ class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler): ...@@ -48,9 +48,9 @@ class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler):
class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler): class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_custom_config().get("defaultPartitions", {}))) self.write(json.dumps(get_custom_config().get("defaultPartitions", {})))
self.set_status(200) self.set_status(200)
...@@ -58,9 +58,9 @@ class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler): ...@@ -58,9 +58,9 @@ class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler):
class FServicesAPIHandler(NoXSRFCheckAPIHandler): class FServicesAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_custom_config().get("services", {}))) self.write(json.dumps(get_custom_config().get("services", {})))
self.set_status(200) self.set_status(200)
...@@ -68,9 +68,9 @@ class FServicesAPIHandler(NoXSRFCheckAPIHandler): ...@@ -68,9 +68,9 @@ class FServicesAPIHandler(NoXSRFCheckAPIHandler):
class FResourcesAPIHandler(NoXSRFCheckAPIHandler): class FResourcesAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_custom_config().get("resources", {}))) self.write(json.dumps(get_custom_config().get("resources", {})))
self.set_status(200) self.set_status(200)
...@@ -78,9 +78,9 @@ class FResourcesAPIHandler(NoXSRFCheckAPIHandler): ...@@ -78,9 +78,9 @@ class FResourcesAPIHandler(NoXSRFCheckAPIHandler):
class FUserModulesAPIHandler(NoXSRFCheckAPIHandler): class FUserModulesAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_custom_config().get("userModules", {}))) self.write(json.dumps(get_custom_config().get("userModules", {})))
self.set_status(200) self.set_status(200)
...@@ -88,9 +88,9 @@ class FUserModulesAPIHandler(NoXSRFCheckAPIHandler): ...@@ -88,9 +88,9 @@ class FUserModulesAPIHandler(NoXSRFCheckAPIHandler):
class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler): class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_custom_config().get("backendServices", {}))) self.write(json.dumps(get_custom_config().get("backendServices", {})))
self.set_status(200) self.set_status(200)
...@@ -98,18 +98,18 @@ class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler): ...@@ -98,18 +98,18 @@ class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler):
class FIncidentCheckAPIHandler(NoXSRFCheckAPIHandler): class FIncidentCheckAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
self.write(json.dumps(get_incidents(user))) self.write(json.dumps(get_incidents(user)))
self.set_status(200) self.set_status(200)
return return
class FReservationsAPIHandler(NoXSRFCheckAPIHandler): class FReservationsAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
self.write(json.dumps(get_reservations())) self.write(json.dumps(get_reservations()))
self.set_status(200) self.set_status(200)
...@@ -117,9 +117,9 @@ class FReservationsAPIHandler(NoXSRFCheckAPIHandler): ...@@ -117,9 +117,9 @@ class FReservationsAPIHandler(NoXSRFCheckAPIHandler):
class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler): class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.get_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is not None: if user is not None:
user_options = await async_decrypted_user_options(user) user_options = await async_decrypted_user_options(user)
self.write(json.dumps(user_options)) self.write(json.dumps(user_options))
...@@ -128,9 +128,9 @@ class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler): ...@@ -128,9 +128,9 @@ class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler):
class FUserAPIHandler(NoXSRFCheckAPIHandler): class FUserAPIHandler(NoXSRFCheckAPIHandler):
async def get(self, user_name=""): async def get(self):
self.set_header("Cache-Control", "no-cache") self.set_header("Cache-Control", "no-cache")
user = self.find_user(user_name) user = self.current_user
if user is None: if user is None:
raise web.HTTPError(404) raise web.HTTPError(404)
...@@ -151,7 +151,7 @@ class FUserAPIHandler(NoXSRFCheckAPIHandler): ...@@ -151,7 +151,7 @@ class FUserAPIHandler(NoXSRFCheckAPIHandler):
return return
default_handlers.append((r"/api/f/incidents", FHostnameAPIHandler)) default_handlers.append((r"/api/f/hostname", FHostnameAPIHandler))
default_handlers.append((r"/api/f/systemconfig", FSystemConfigAPIHandler)) default_handlers.append((r"/api/f/systemconfig", FSystemConfigAPIHandler))
default_handlers.append((r"/api/f/mapsystems", FMapSystemsAPIHandler)) default_handlers.append((r"/api/f/mapsystems", FMapSystemsAPIHandler))
default_handlers.append((r"/api/f/mappartitions", FMapPartitionsAPIHandler)) default_handlers.append((r"/api/f/mappartitions", FMapPartitionsAPIHandler))
...@@ -163,4 +163,5 @@ default_handlers.append((r"/api/f/backendservices", FBackendServicesAPIHandler)) ...@@ -163,4 +163,5 @@ default_handlers.append((r"/api/f/backendservices", FBackendServicesAPIHandler))
default_handlers.append((r"/api/f/incidents", FIncidentCheckAPIHandler)) default_handlers.append((r"/api/f/incidents", FIncidentCheckAPIHandler))
default_handlers.append((r"/api/f/reservations", FReservationsAPIHandler)) default_handlers.append((r"/api/f/reservations", FReservationsAPIHandler))
default_handlers.append((r"/api/f/useroptions", FUserOptionsAPIHandler)) default_handlers.append((r"/api/f/useroptions", FUserOptionsAPIHandler))
default_handlers.append((r"/api/f/users", FUserAPIHandler)) default_handlers.append((r"/api/f/users", FUserAPIHandler))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment