app/controllers/effective/pages_controller.rb in effective_pages-2.0.8 vs app/controllers/effective/pages_controller.rb in effective_pages-2.0.9
- old
+ new
@@ -1,16 +1,18 @@
module Effective
class PagesController < ApplicationController
+ before_action(:authenticate_user!) if EffectivePages.authenticate_user # Devise
+
def show
@pages = Effective::Page.all
@pages = @pages.published unless EffectivePages.authorized?(self, :admin, :effective_pages)
@page = @pages.find(params[:id])
raise ActiveRecord::RecordNotFound unless @page.present? # Incase .find() isn't raising it
raise Effective::AccessDenied.new('Access Denied', :show, @page) unless @page.roles_permit?(current_user)
- EffectivePages.authorized?(self, :show, @page)
+ EffectivePages.authorize!(self, :show, @page)
@page_title = @page.title
@meta_description = @page.meta_description
@canonical_url = effective_pages.page_url(@page)