Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Allow ldap_tls_options to be a setting

Oliver Güntherc9cbc40e67d7
diff --git a/app/models/ldap_auth_source.rb b/app/models/ldap_auth_source.rb
index 27cc5983074..0227a1de034 100644
--- a/app/models/ldap_auth_source.rb
+++ b/app/models/ldap_auth_source.rb
@@ -163,7 +163,7 @@ class LdapAuthSource < AuthSource
{
method: tls_mode.to_sym,
- tls_options: OpenProject::Configuration.ldap_tls_options.with_indifferent_access
+ tls_options: Setting.ldap_tls_options.with_indifferent_access
}
end
diff --git a/config/constants/settings/definitions.rb b/config/constants/settings/definitions.rb
index cf062ee23ac..4628e36f5a9 100644
--- a/config/constants/settings/definitions.rb
+++ b/config/constants/settings/definitions.rb
@@ -537,8 +537,9 @@ Settings::Definition.define do
writable: false
add :ldap_tls_options,
+ format: :hash,
default: {},
- writable: false
+ writable: true
add :log_level,
default: 'info',
diff --git a/spec/models/ldap_auth_source_spec.rb b/spec/models/ldap_auth_source_spec.rb
index 0f624a12e00..4d755bc2b15 100644
--- a/spec/models/ldap_auth_source_spec.rb
+++ b/spec/models/ldap_auth_source_spec.rb
@@ -43,7 +43,7 @@ describe LdapAuthSource, type: :model do
end
describe 'overriding tls_options',
- with_config: { ldap_tls_options: { ca_file: '/path/to/ca/file' } } do
+ with_settings: { ldap_tls_options: { ca_file: '/path/to/ca/file' } } do
it 'sets the encryption options for start_tls' do
ldap = LdapAuthSource.new tls_mode: :start_tls
expect(ldap.send(:ldap_encryption)).to eq(method: :start_tls, tls_options: { 'ca_file' => '/path/to/ca/file' })