Sha256: 85d07f32c0bc59ebeb1f7418a151989c36a783ff2e70650751d317f2c3ab396d

Contents?: true

Size: 754 Bytes

Versions: 7

Compression:

Stored size: 754 Bytes

Contents

module Commontator
  class ApplicationController < ActionController::Base
    before_filter :get_user
    
    class SecurityTransgression < StandardError; end
    
    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])
    end
    
    def get_commontable_url
      @commontable_url = @thread.config.commontable_url_proc.call(main_app, @thread.commontable)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
commontator-1.0.6 app/controllers/commontator/application_controller.rb~
commontator-1.0.5 app/controllers/commontator/application_controller.rb~
commontator-1.0.4 app/controllers/commontator/application_controller.rb~
commontator-1.0.3 app/controllers/commontator/application_controller.rb~
commontator-1.0.2 app/controllers/commontator/application_controller.rb~
commontator-1.0.1 app/controllers/commontator/application_controller.rb~
commontator-1.0.0 app/controllers/commontator/application_controller.rb~