[PATCH 2 of 2] admin: auth: make sure list of auth modules is consistent

Thomas De Schampheleire thomas.de_schampheleire at nokia.com
Wed May 2 06:18:02 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1524513997 -7200
#      Mon Apr 23 22:06:37 2018 +0200
# Node ID d65b3b8f37c67a5cc17c7b1a70ac88f5a5bc9470
# Parent  bbdcbac9f5dda7071b951b14b3ffc5c51a303fe5
admin: auth: make sure list of auth modules is consistent

When authentication modules are enabled, but fail to be enabled e.g. due to
missing dependencies (pam, ldap), the list of enabled plugins still contains
the failing module. However, the 'Enabled/Disabled' button correctly shows
Disabled, causing a mismatch between both.

Worse, the mismatch cannot be corrected by clicking the Enabled/Disabled
button, one needs to manually clear the problematic entry in the list of
enabled plugins.

Fix by always populating the list with the actually enabled plugins, not
those requested by the user in case there are failures.

diff --git a/kallithea/controllers/admin/auth_settings.py b/kallithea/controllers/admin/auth_settings.py
--- a/kallithea/controllers/admin/auth_settings.py
+++ b/kallithea/controllers/admin/auth_settings.py
@@ -79,12 +79,12 @@ class AuthSettingsController(BaseControl
                 setting = Setting.get_by_name(fullname)
                 if setting is not None:
                     c.defaults[fullname] = setting.app_settings_value
+        if defaults:
+            c.defaults.update(defaults)
+
         # we want to show , separated list of enabled plugins
         c.defaults['auth_plugins'] = ','.join(c.enabled_plugin_names)
 
-        if defaults:
-            c.defaults.update(defaults)
-
         log.debug(formatted_json(defaults))
         return formencode.htmlfill.render(
             render('admin/auth/auth_settings.html'),


More information about the kallithea-general mailing list