forcelogin: ui_render sorting key of 0

If third party UIPlugin want to override the forcelogin plugin, they'll
need to return a negative sorting key.
This commit is contained in:
Gina Häußge committed 2019-01-17 17:55:24 +01:00
1 parent 3b26a2f7d2
commit 2287c65784
1 file changed
+8
@@ -103,6 +103,14 @@ class ForceLoginPlugin(octoprint.plugin.UiPlugin,
def get_ui_preemptive_caching_enabled(self):
return False
def get_sorting_key(self, context=None):
if context == "UiPlugin.on_ui_render":
# If a plugin *really* wants to come before this plugin, it'll have to turn to negative numbers.
#
# This is obviously discouraged for security reasons, but very specific setups might make it necessary,
# so we make it possible. If this should get abused long term we can always turn this into -inf.
return 0
def get_before_request_handlers(self):
def check_login_required():
if self._user_manager.enabled and not self._user_manager.hasBeenCustomized():