Show More
@@ -22,6 +22,7 b' news' | |||||
22 | IP for pull/push logs. - moved all to base controller |
|
22 | IP for pull/push logs. - moved all to base controller | |
23 | - #415: Adding comment to changeset causes reload. |
|
23 | - #415: Adding comment to changeset causes reload. | |
24 | Comments are now added via ajax and doesn't reload the page |
|
24 | Comments are now added via ajax and doesn't reload the page | |
|
25 | - #374 LDAP config is discarded when LDAP can't be activated | |||
25 |
|
26 | |||
26 | fixes |
|
27 | fixes | |
27 | +++++ |
|
28 | +++++ |
@@ -100,25 +100,37 b' class LdapSettingsController(BaseControl' | |||||
100 | _form = LdapSettingsForm([x[0] for x in self.tls_reqcert_choices], |
|
100 | _form = LdapSettingsForm([x[0] for x in self.tls_reqcert_choices], | |
101 | [x[0] for x in self.search_scope_choices], |
|
101 | [x[0] for x in self.search_scope_choices], | |
102 | [x[0] for x in self.tls_kind_choices])() |
|
102 | [x[0] for x in self.tls_kind_choices])() | |
|
103 | # check the ldap lib | |||
|
104 | ldap_active = False | |||
|
105 | try: | |||
|
106 | import ldap | |||
|
107 | ldap_active = True | |||
|
108 | except ImportError: | |||
|
109 | pass | |||
103 |
|
110 | |||
104 | try: |
|
111 | try: | |
105 | form_result = _form.to_python(dict(request.POST)) |
|
112 | form_result = _form.to_python(dict(request.POST)) | |
|
113 | ||||
106 | try: |
|
114 | try: | |
107 |
|
115 | |||
108 | for k, v in form_result.items(): |
|
116 | for k, v in form_result.items(): | |
109 | if k.startswith('ldap_'): |
|
117 | if k.startswith('ldap_'): | |
|
118 | if k == 'ldap_active': | |||
|
119 | v = ldap_active | |||
110 | setting = RhodeCodeSetting.get_by_name(k) |
|
120 | setting = RhodeCodeSetting.get_by_name(k) | |
111 | setting.app_settings_value = v |
|
121 | setting.app_settings_value = v | |
112 | self.sa.add(setting) |
|
122 | self.sa.add(setting) | |
113 |
|
123 | |||
114 | self.sa.commit() |
|
124 | self.sa.commit() | |
115 | h.flash(_('Ldap settings updated successfully'), |
|
125 | h.flash(_('Ldap settings updated successfully'), | |
116 | category='success') |
|
126 | category='success') | |
|
127 | if not ldap_active: | |||
|
128 | #if ldap is missing send an info to user | |||
|
129 | h.flash(_('Unable to activate ldap. The "python-ldap" library ' | |||
|
130 | 'is missing.'), category='warning') | |||
|
131 | ||||
117 | except (DatabaseError,): |
|
132 | except (DatabaseError,): | |
118 | raise |
|
133 | raise | |
119 | except LdapImportError: |
|
|||
120 | h.flash(_('Unable to activate ldap. The "python-ldap" library ' |
|
|||
121 | 'is missing.'), category='warning') |
|
|||
122 |
|
134 | |||
123 | except formencode.Invalid, errors: |
|
135 | except formencode.Invalid, errors: | |
124 | e = errors.error_dict or {} |
|
136 | e = errors.error_dict or {} |
@@ -754,7 +754,7 b' def LdapSettingsForm(tls_reqcert_choices' | |||||
754 | class _LdapSettingsForm(formencode.Schema): |
|
754 | class _LdapSettingsForm(formencode.Schema): | |
755 | allow_extra_fields = True |
|
755 | allow_extra_fields = True | |
756 | filter_extra_fields = True |
|
756 | filter_extra_fields = True | |
757 | pre_validators = [LdapLibValidator] |
|
757 | #pre_validators = [LdapLibValidator] | |
758 | ldap_active = StringBoolean(if_missing=False) |
|
758 | ldap_active = StringBoolean(if_missing=False) | |
759 | ldap_host = UnicodeString(strip=True,) |
|
759 | ldap_host = UnicodeString(strip=True,) | |
760 | ldap_port = Number(strip=True,) |
|
760 | ldap_port = Number(strip=True,) |
General Comments 0
You need to be logged in to leave comments.
Login now