From af6ed56e13ab6ecf51b6c09e9a9a1631df6aa6b5 Mon Sep 17 00:00:00 2001 From: Chris Conner Date: Wed, 1 Apr 2015 12:51:41 -0400 Subject: [PATCH] Final version of HUE-2671 patch --- apps/useradmin/src/useradmin/ldap_access.py | 9 ++++++++- desktop/conf.dist/hue.ini | 16 +++++++++++++--- desktop/conf/pseudo-distributed.ini.tmpl | 16 +++++++++++++--- desktop/core/src/desktop/conf.py | 14 ++++++++++++++ 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/apps/useradmin/src/useradmin/ldap_access.py b/apps/useradmin/src/useradmin/ldap_access.py index 6279fe0..ccf258d 100644 --- a/apps/useradmin/src/useradmin/ldap_access.py +++ b/apps/useradmin/src/useradmin/ldap_access.py @@ -35,7 +35,14 @@ CACHED_LDAP_CONN = None def get_connection_from_server(server=None): - ldap_config = desktop.conf.LDAP.LDAP_SERVERS.get()[server] if server else desktop.conf.LDAP + + ldap_servers = desktop.conf.LDAP.LDAP_SERVERS.get() + + if server and ldap_servers: + ldap_config = ldap_servers[server] + else: + ldap_config = desktop.conf.LDAP + return get_connection(ldap_config) def get_connection(ldap_config): diff --git a/desktop/conf.dist/hue.ini b/desktop/conf.dist/hue.ini index 606158b..d73299c 100644 --- a/desktop/conf.dist/hue.ini +++ b/desktop/conf.dist/hue.ini @@ -212,9 +212,6 @@ # Defaults to HTTP_REMOTE_USER ## remote_user_header=HTTP_REMOTE_USER - # Synchronize a users groups when they login - ## sync_groups_on_login=false - # Ignore the case of usernames when searching for existing users. # Only supported in remoteUserDjangoBackend. ## ignore_username_case=true @@ -268,6 +265,9 @@ # For use when using LdapBackend for Hue authentication ## create_users_on_login = true + # Synchronize a users groups when they login + ## sync_groups_on_login=false + # Ignore the case of usernames when searching for existing users in Hue. ## ignore_username_case=false @@ -355,6 +355,16 @@ # Whether or not to follow referrals ## follow_referrals=false + # Enable python-ldap debugging. + ## debug=false + + # Sets the debug level within the underlying LDAP C lib. + ## debug_level=255 + + # Possible values for trace_level are 0 for no logging, 1 for only logging the method calls with arguments, + # 2 for logging the method calls with arguments and the complete results and 9 for also logging the traceback of method calls. + ## trace_level=0 + ## [[[[[users]]]]] # Base filter for searching for users diff --git a/desktop/conf/pseudo-distributed.ini.tmpl b/desktop/conf/pseudo-distributed.ini.tmpl index c8a37c3..24ff874 100644 --- a/desktop/conf/pseudo-distributed.ini.tmpl +++ b/desktop/conf/pseudo-distributed.ini.tmpl @@ -219,9 +219,6 @@ # Defaults to HTTP_REMOTE_USER ## remote_user_header=HTTP_REMOTE_USER - # Synchronize a users groups when they login - ## sync_groups_on_login=false - # Ignore the case of usernames when searching for existing users. # Only supported in remoteUserDjangoBackend. ## ignore_username_case=true @@ -275,6 +272,9 @@ # For use when using LdapBackend for Hue authentication ## create_users_on_login = true + # Synchronize a users groups when they login + ## sync_groups_on_login=false + # Ignore the case of usernames when searching for existing users in Hue. ## ignore_username_case=false @@ -362,6 +362,16 @@ # Whether or not to follow referrals ## follow_referrals=false + # Enable python-ldap debugging. + ## debug=false + + # Sets the debug level within the underlying LDAP C lib. + ## debug_level=255 + + # Possible values for trace_level are 0 for no logging, 1 for only logging the method calls with arguments, + # 2 for logging the method calls with arguments and the complete results and 9 for also logging the traceback of method calls. + ## trace_level=0 + ## [[[[[users]]]]] # Base filter for searching for users diff --git a/desktop/core/src/desktop/conf.py b/desktop/core/src/desktop/conf.py index 4214d9e..a6040c4 100644 --- a/desktop/core/src/desktop/conf.py +++ b/desktop/core/src/desktop/conf.py @@ -610,6 +610,20 @@ LDAP = ConfigSection( type=coerce_bool, default=False), + DEBUG = Config("debug", + type=coerce_bool, + default=False, + help=_("Set to a value to enable python-ldap debugging.")), + DEBUG_LEVEL = Config("debug_level", + default=255, + type=int, + help=_("Sets the debug level within the underlying LDAP C lib.")), + TRACE_LEVEL = Config("trace_level", + default=0, + type=int, + help=_("Possible values for trace_level are 0 for no logging, 1 for only logging the method calls with arguments," + "2 for logging the method calls with arguments and the complete results and 9 for also logging the traceback of method calls.")), + USERS = ConfigSection( key="users", help=_("Configuration for LDAP user schema and search."), -- 1.9.5 (Apple Git-50.3)