2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-12-23 03:00:49 -05:00
|
|
|
class EnableSsoValidator
|
|
|
|
def initialize(opts = {})
|
|
|
|
@opts = opts
|
|
|
|
end
|
|
|
|
|
|
|
|
def valid_value?(val)
|
|
|
|
return true if val == 'f'
|
2019-04-02 10:26:27 -04:00
|
|
|
return false if SiteSetting.sso_url.blank? || SiteSetting.invite_only?
|
|
|
|
true
|
2017-12-23 03:00:49 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def error_message
|
2019-04-02 10:26:27 -04:00
|
|
|
return I18n.t('site_settings.errors.sso_url_is_empty') if SiteSetting.sso_url.blank?
|
|
|
|
return I18n.t('site_settings.errors.sso_invite_only') if SiteSetting.invite_only?
|
2017-12-23 03:00:49 -05:00
|
|
|
end
|
|
|
|
end
|