Sha256: 2bbedcfbd5a2fb63cd1c1d39177513c26f70c2f73c72cea25e559ae3303b9182
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
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(url) page = find_page_without_group_check(url) raise ReaderError::AccessDenied if page && !page.visible_to?(current_reader) page end def show_page_with_group_check show_page_without_group_check rescue ReaderError::AccessDenied if current_reader flash[:error] = t("reader_extension.access_denied") redirect_to reader_permission_denied_url else flash[:explanation] = t("reader_extension.page_not_public") flash[:error] = t("reader_extension.please_log_in") store_location redirect_to reader_login_url end end alias_method_chain :find_page, :group_check alias_method_chain :show_page, :group_check } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
radiant-reader-extension-3.0.0.rc4 | lib/site_controller_extensions.rb |
radiant-reader-extension-3.0.0.rc3 | lib/site_controller_extensions.rb |