1
0

domain_control_helper.rb 528 B

1234567891011121314151617181920212223
  1. # frozen_string_literal: true
  2. module DomainControlHelper
  3. def domain_not_allowed?(uri_or_domain)
  4. return false if uri_or_domain.blank?
  5. domain = if uri_or_domain.include?('://')
  6. Addressable::URI.parse(uri_or_domain).host
  7. else
  8. uri_or_domain
  9. end
  10. if limited_federation_mode?
  11. !DomainAllow.allowed?(domain)
  12. else
  13. DomainBlock.blocked?(domain)
  14. end
  15. end
  16. def limited_federation_mode?
  17. Rails.configuration.x.limited_federation_mode
  18. end
  19. end