Needed for NagVis Multisite Authorisation)
Message-ID: <510fef4a.OGt9N+jGHMnDXqSE%lm(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: d62f17d5c552a07eeba4c5cdbd66f2db71f01abd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d62f17d5c552a0…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Feb 4 09:41:23 2013 +0100
FIX: Fixed generation of auth.php (Needed for NagVis Multisite Authorisation)
---
ChangeLog | 3 ++-
web/htdocs/hooks.py | 18 ++++++++++++++++++
web/htdocs/index.py | 4 ++--
web/htdocs/wato.py | 2 --
4 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 815639f..680c565 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -36,12 +36,13 @@
WATO:
* Added hr_mem check to the memory checkgroup to make it configurable in WATO
+ * Make page_header configurable in global settings
* FIX: Fixed some typos in ldap error messages
* FIX: Fixed problem on user profile page when no alias set for a user
* FIX: list valuespecs could not be extended after once saving
* FIX: fix title of foldable areas contained in list valuespecs
* FIX: Fixed bug where pending log was not removed in multisite setup
- * Make page_header configurable in global settings
+ * FIX: Fixed generation of auth.php (Needed for NagVis Multisite Authorisation)
Event Console:
* Added UNIX socket for sending events to the EC
diff --git a/web/htdocs/hooks.py b/web/htdocs/hooks.py
index ea4dc53..c035cfb 100644
--- a/web/htdocs/hooks.py
+++ b/web/htdocs/hooks.py
@@ -28,6 +28,24 @@ import config, sys
hooks = {}
+# Datastructures and functions needed before plugins can be loaded
+loaded_with_language = False
+
+# Load all login plugins
+def load_plugins():
+ global loaded_with_language
+ if loaded_with_language == current_language:
+ return
+
+ # Cleanup all registered hooks. They need to be renewed by load_plugins()
+ # of the other modules
+ unregister()
+
+ # This must be set after plugin loading to make broken plugins raise
+ # exceptions all the time and not only the first time (when the plugins
+ # are loaded).
+ loaded_with_language = current_language
+
def unregister():
global hooks
hooks = {}
diff --git a/web/htdocs/index.py b/web/htdocs/index.py
index 9a2ab1b..1022055 100644
--- a/web/htdocs/index.py
+++ b/web/htdocs/index.py
@@ -35,7 +35,7 @@ from mod_python import apache, util, Cookie
import sys, os, pprint
from lib import *
import livestatus
-import defaults, config, htmllib, login, userdb, default_permissions
+import defaults, config, htmllib, login, userdb, hooks, default_permissions
# Load page handlers
pagehandlers = {}
@@ -178,7 +178,7 @@ def connect_to_livestatus(html):
# Call the load_plugins() function in all modules
def load_all_plugins():
- for module in [ userdb, views, sidebar, dashboard, wato, bi, mobile ]:
+ for module in [ hooks, userdb, views, sidebar, dashboard, wato, bi, mobile ]:
try:
module.load_plugins # just check if this function exists
module.load_plugins()
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index cce9eca..c77cba2 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -11881,8 +11881,6 @@ def load_plugins():
g_rulespec_group = {}
g_rulespec_groups = []
- hooks.unregister()
-
# Declare WATO-specific permissions
config.declare_permission_section("wato", _("WATO - Check_MK's Web
Administration Tool"))