Add automatic configuration? helper

pull/4167/head
Oliver Günther 9 years ago
parent fb4bf739d9
commit 83b96e478a
  1. 5
      lib/open_project/configuration.rb
  2. 17
      lib/open_project/configuration/helpers.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

@ -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

Loading…
Cancel
Save