Sha256: 0f04c9f11da92aec086832fb9d59d6d82ff56f014e70ab045be0e805a3f7ad5b

Contents?: true

Size: 1.03 KB

Versions: 4

Compression:

Stored size: 1.03 KB

Contents

class ApplicationController < ActionController::Base
  protect_from_forgery
  
  helper_method :rules_engine_reader?, :rules_engine_editor?

  def rules_engine_reader?
    # why cookies[:rules_engine_reader] ? It's a workaround for cucumber testing
    return cookies[:rules_engine_reader].nil? ? true : 
                                                cookies[:rules_engine_reader].downcase == 'true'
  end  

  def rules_engine_editor?
    # why cookies[:rules_engine_editor] ? It's a workaround for cucumber testing
    return cookies[:rules_engine_editor].nil? ? true : 
                                                cookies[:rules_engine_editor].downcase == 'true'
  end  

  def rules_engine_reader_access_required
    unless rules_engine_reader?    
      redirect_to(root_path) 
      flash[:success] = 'Rules Engine Access Denied.'
    end  
  end

  def rules_engine_editor_access_required
    unless rules_engine_editor?    
      redirect_to(root_path) 
      flash[:success] = 'Rules Engine Editor Access Denied.'
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rules_engine-0.3.3 spec/rails_3_0_0_root/app/controllers/application_controller.rb
rules_engine-0.3.2 spec/rails_3_0_0_root/app/controllers/application_controller.rb
rules_engine-0.3.1 spec/rails_3_0_0_root/app/controllers/application_controller.rb
rules_engine-0.3.0 spec/rails_3_0_0_root/app/controllers/application_controller.rb