##// END OF EJS Templates
authn: Allow users to store plugin ID's starting with the legacy plugin prefix.
johbo -
r133:1c4d75a0 default
parent child Browse files
Show More
@@ -38,9 +38,9 b' from sqlalchemy.sql.expression import tr'
38 from sqlalchemy.util import OrderedSet
38 from sqlalchemy.util import OrderedSet
39 from webhelpers.pylonslib.secure_form import authentication_token
39 from webhelpers.pylonslib.secure_form import authentication_token
40
40
41 from rhodecode.authentication import legacy_plugin_prefix
41 from rhodecode.config.routing import ADMIN_PREFIX
42 from rhodecode.config.routing import ADMIN_PREFIX
42 from rhodecode.lib.auth import HasRepoGroupPermissionAny, HasPermissionAny
43 from rhodecode.lib.auth import HasRepoGroupPermissionAny, HasPermissionAny
43 from rhodecode.lib.exceptions import LdapImportError
44 from rhodecode.lib.utils import repo_name_slug, make_db_config
44 from rhodecode.lib.utils import repo_name_slug, make_db_config
45 from rhodecode.lib.utils2 import safe_int, str2bool, aslist, md5
45 from rhodecode.lib.utils2 import safe_int, str2bool, aslist, md5
46 from rhodecode.lib.vcs.backends.git.repository import GitRepository
46 from rhodecode.lib.vcs.backends.git.repository import GitRepository
@@ -995,12 +995,11 b' def ValidAuthPlugins():'
995 from rhodecode.authentication.base import loadplugin
995 from rhodecode.authentication.base import loadplugin
996 module_list = value
996 module_list = value
997 unique_names = {}
997 unique_names = {}
998 try:
998 for module in module_list:
999 for module in module_list:
1000 if module.startswith(legacy_plugin_prefix):
1001 continue
999 plugin = loadplugin(module)
1002 plugin = loadplugin(module)
1000 if plugin is None:
1001 raise formencode.Invalid(
1002 _("Can't find plugin with id '{}'".format(module)),
1003 value, state)
1004 plugin_name = plugin.name
1003 plugin_name = plugin.name
1005 if plugin_name in unique_names:
1004 if plugin_name in unique_names:
1006 msg = M(self, 'import_duplicate', state,
1005 msg = M(self, 'import_duplicate', state,
@@ -1008,6 +1007,8 b' def ValidAuthPlugins():'
1008 next_to_load=plugin_name)
1007 next_to_load=plugin_name)
1009 raise formencode.Invalid(msg, value, state)
1008 raise formencode.Invalid(msg, value, state)
1010 unique_names[plugin_name] = plugin
1009 unique_names[plugin_name] = plugin
1010 except (KeyError, AttributeError, TypeError) as e:
1011 raise formencode.Invalid(str(e), value, state)
1011
1012
1012 return _validator
1013 return _validator
1013
1014
General Comments 0
You need to be logged in to leave comments. Login now