webadmin feature flag

This commit is contained in:
Jakob Ketterl 2020-04-01 21:39:53 +02:00
parent b7831b824a
commit 3f742c7b1a

View File

@ -1,5 +1,6 @@
from .template import WebpageController from .template import WebpageController
from .session import SessionStorage from .session import SessionStorage
from owrx.config import Config
class Authentication(object): class Authentication(object):
@ -16,6 +17,10 @@ class AdminController(WebpageController):
super().__init__(handler, request, options) super().__init__(handler, request, options)
def handle_request(self): def handle_request(self):
config = Config.get()
if not config["webadmin_enabled"]:
self.send_response("Web Admin is disabled", code=403)
return
if self.authentication.isAuthenticated(self.request): if self.authentication.isAuthenticated(self.request):
super().handle_request() super().handle_request()
else: else: