Commit ce9ed8c7 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Include inactive auth providers in registry

parent 38c1856f
......@@ -44,8 +44,7 @@ import logging
logger = logging.getLogger(__name__)
# providers registry
PROVIDERS = SortedDict()
_PROVIDERS = {}
PROVIDERS = {}
class AuthProviderBase(type):
......@@ -60,7 +59,7 @@ class AuthProviderBase(type):
newcls = super(AuthProviderBase, cls).__new__(cls, name, bases, dct)
if include:
_PROVIDERS[type_id] = newcls
PROVIDERS[type_id] = newcls
return newcls
......@@ -172,8 +171,3 @@ def get_provider(id, user_obj=None, default=None):
"""
return PROVIDERS.get(id, default)(user_obj)
for module in astakos_settings.IM_MODULES:
if module in _PROVIDERS:
PROVIDERS[module] = _PROVIDERS[module]
......@@ -48,11 +48,14 @@ def im_modules(request):
return {'im_modules': IM_MODULES}
def auth_providers(request):
active_auth_providers = filter(lambda p:p.module_enabled,
AUTH_PROVIDERS.itervalues())
auth_providers = map(lambda p: p(), active_auth_providers)
return {'auth_providers': auth_providers,
'master_auth_provider': auth_providers[0]}
active_auth_providers = []
for module in IM_MODULES:
provider = AUTH_PROVIDERS.get(module)
if provider:
active_auth_providers.append(provider)
return {'auth_providers': active_auth_providers,
'master_auth_provider': active_auth_providers[0]}
def next(request):
return {'next': get_query(request).get('next', '')}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment