lib/cms/fortress/rails/engine.rb in cms-fortress-1.2.2 vs lib/cms/fortress/rails/engine.rb in cms-fortress-1.3.0.rc1

- old
+ new

@@ -8,18 +8,27 @@ ApplicationController.helper(Cms::Fortress::ApplicationHelper) Sprockets::Context.send :include, Cms::Fortress::SprocketHelper Comfy::Cms::ContentController.send(:include, Cms::Fortress::ContentRenderer) + Comfy::Admin::Cms::PagesController.send(:include, Cms::Fortress::PagesControllerMethods) Comfy::Cms::Page.send(:include, Cms::Fortress::PageMethods) Comfy::Cms::File.send(:include, Cms::Fortress::FileMethods) + Comfy::Cms::Site.send(:include, Cms::Fortress::SiteMethods) - # Insert Roles - Comfy::Admin::Cms::SitesController.class_eval do + + Comfy::Admin::Cms::BaseController.class_eval do before_action do - authorize! :manage, Comfy::Cms::Site + if current_cms_fortress_user && current_cms_fortress_user.type.eql?(:site_user) + @site = current_cms_fortress_user.site + session[:site_id] = @site.id if @site + end end end + + # Insert Roles + Comfy::Admin::Cms::SitesController.send :include, Cms::Fortress::SiteControllerMethods + Comfy::Admin::Cms::LayoutsController.class_eval do before_action do authorize! :manage, Comfy::Cms::Layout end end