From 83b96e478a351d0f071dbbc45a08cf149c57964c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Thu, 18 Feb 2016 19:38:49 +0100 Subject: [PATCH] Add automatic configuration? helper --- lib/open_project/configuration.rb | 5 +++++ lib/open_project/configuration/helpers.rb | 17 ----------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/lib/open_project/configuration.rb b/lib/open_project/configuration.rb index 810575f46a..64d2fd0103 100644 --- a/lib/open_project/configuration.rb +++ b/lib/open_project/configuration.rb @@ -320,6 +320,11 @@ module OpenProject define_method setting do self[setting] end + + define_method "#{setting}?" do + ['true', true, '1'].include? self[setting] + end + end unless respond_to? setting end end diff --git a/lib/open_project/configuration/helpers.rb b/lib/open_project/configuration/helpers.rb index 1e465e5894..7618c77296 100644 --- a/lib/open_project/configuration/helpers.rb +++ b/lib/open_project/configuration/helpers.rb @@ -33,19 +33,6 @@ module OpenProject # To be included into OpenProject::Configuration in order to provide # helper methods for easier access to certain configuration options. module Helpers - ## - # Activating this leaves omniauth as the only way to authenticate. - def disable_password_login? - true? self['disable_password_login'] - end - - ## - # If this is true a user's password cannot be chosen when editing a user. - # The only way to change the password is to generate a random one which is sent - # to the user who then has to change it immediately. - def disable_password_choice? - true? self['disable_password_choice'] - end ## # Carrierwave storage type. Possible values are, among others, :file and :fog. @@ -106,10 +93,6 @@ module OpenProject Array(value) end end - - def true?(value) - ['true', true].include? value # check string to accommodate ENV override - end end end end