Sha256: 200736de2496281df10c4253c60f88a7df6a5c7c0188dfa19f506431e74ef9ef

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 Bytes

Contents

module SiteControllerExtensions
  
  def self.included(base)
    base.class_eval {
      # NB. to control access without disabling the cache we have overridden Page.cache? 
      # to return false for any page that has a group association.
      
      def find_page_with_group_check(path)
        page = find_page_without_group_check(path)
        if page && page.restricted?
          raise ReaderError::LoginRequired, t("reader_extension.page_not_public") unless current_reader
          raise ReaderError::ActivationRequired, t("reader_extension.page_not_public") unless current_reader.activated?
          raise ReaderError::AccessDenied, t("reader_extension.page_permission_denied") unless page.visible_to?(current_reader)
        end
        page
      end
      alias_method_chain :find_page, :group_check
    }
  end
end



Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-reader-extension-3.0.18 lib/site_controller_extensions.rb
radiant-reader-extension-3.0.17 lib/site_controller_extensions.rb
radiant-reader-extension-3.0.16 lib/site_controller_extensions.rb
radiant-reader-extension-3.0.15 lib/site_controller_extensions.rb
radiant-reader-extension-3.0.14 lib/site_controller_extensions.rb