Sha256: 891f2d7ec5a96964a2b2d86875faa22d7bbd588ff61c6203b3bdd3dcb3b6633a

Contents?: true

Size: 803 Bytes

Versions: 3

Compression:

Stored size: 803 Bytes

Contents

module Commontator
  class CommontatorController < ActionController::Base
    before_filter :get_user
    
    cattr_accessor :commontable_url
    
    rescue_from SecurityTransgression, :with => lambda { head(:forbidden) }
    
    protected
    
    def get_user
      @user = self.send Commontator.current_user_method	
      raise SecurityTransgression unless (@user.nil? || @user.is_commontator)
    end
    
    def get_thread
      @thread = params[:thread_id].blank? ? \
        Commontator::Thread.find(params[:id]) : \
        Commontator::Thread.find(params[:thread_id])
      raise SecurityTransgression if @thread.commontable.nil?
    end
    
    def set_commontable_url
      self.commontable_url = @thread.config.commontable_url_proc.call(main_app, @thread.commontable)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
commontator-2.0.2 app/controllers/commontator/application_controller.rb~
commontator-4.0.1 app/controllers/commontator/application_controller.rb~
commontator-4.0.0 app/controllers/commontator/application_controller.rb~