diff --git a/jsc_custom/apihandler/frontend.py b/jsc_custom/apihandler/frontend.py index ad9cc42468c6f142a0c3ca94d1a4d55e483b2f43..2cfa684fef5c3616ccf9857d782cdbd643c39744 100644 --- a/jsc_custom/apihandler/frontend.py +++ b/jsc_custom/apihandler/frontend.py @@ -12,7 +12,7 @@ from .misc import NoXSRFCheckAPIHandler class FHostnameAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") self.write(jhub_hostname) self.set_status(200) @@ -20,7 +20,7 @@ class FHostnameAPIHandler(NoXSRFCheckAPIHandler): class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") self.write(json.dumps(get_custom_config().get("systems", {}))) self.set_status(200) @@ -28,9 +28,9 @@ class FSystemConfigAPIHandler(NoXSRFCheckAPIHandler): class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_custom_config().get("mapSystems", {}))) self.set_status(200) @@ -38,9 +38,9 @@ class FMapSystemsAPIHandler(NoXSRFCheckAPIHandler): class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_custom_config().get("mapPartitions", {}))) self.set_status(200) @@ -48,9 +48,9 @@ class FMapPartitionsAPIHandler(NoXSRFCheckAPIHandler): class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_custom_config().get("defaultPartitions", {}))) self.set_status(200) @@ -58,9 +58,9 @@ class FDefaultPartitionsAPIHandler(NoXSRFCheckAPIHandler): class FServicesAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_custom_config().get("services", {}))) self.set_status(200) @@ -68,9 +68,9 @@ class FServicesAPIHandler(NoXSRFCheckAPIHandler): class FResourcesAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_custom_config().get("resources", {}))) self.set_status(200) @@ -78,9 +78,9 @@ class FResourcesAPIHandler(NoXSRFCheckAPIHandler): class FUserModulesAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_custom_config().get("userModules", {}))) self.set_status(200) @@ -88,9 +88,9 @@ class FUserModulesAPIHandler(NoXSRFCheckAPIHandler): class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_custom_config().get("backendServices", {}))) self.set_status(200) @@ -98,18 +98,18 @@ class FBackendServicesAPIHandler(NoXSRFCheckAPIHandler): class FIncidentCheckAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): 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.set_status(200) return class FReservationsAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is not None: self.write(json.dumps(get_reservations())) self.set_status(200) @@ -117,9 +117,9 @@ class FReservationsAPIHandler(NoXSRFCheckAPIHandler): class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): - self.get_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + async def get(self): + self.set_header("Cache-Control", "no-cache") + user = self.current_user if user is not None: user_options = await async_decrypted_user_options(user) self.write(json.dumps(user_options)) @@ -128,9 +128,9 @@ class FUserOptionsAPIHandler(NoXSRFCheckAPIHandler): class FUserAPIHandler(NoXSRFCheckAPIHandler): - async def get(self, user_name=""): + async def get(self): self.set_header("Cache-Control", "no-cache") - user = self.find_user(user_name) + user = self.current_user if user is None: raise web.HTTPError(404) @@ -151,7 +151,7 @@ class FUserAPIHandler(NoXSRFCheckAPIHandler): 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/mapsystems", FMapSystemsAPIHandler)) default_handlers.append((r"/api/f/mappartitions", FMapPartitionsAPIHandler)) @@ -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/reservations", FReservationsAPIHandler)) default_handlers.append((r"/api/f/useroptions", FUserOptionsAPIHandler)) + default_handlers.append((r"/api/f/users", FUserAPIHandler))