Sha256: 5c91717da024f7a73e324c8249f7da432cb6541a64f03a8401c0de181c0f6b4c
Contents?: true
Size: 858 Bytes
Versions: 1
Compression:
Stored size: 858 Bytes
Contents
module Bagboy class ApplicationController < ActionController::Base before_action :authorize def initialize super @bag_helper = Bagboy::Chef::DataBagsHelper.instance @bags = @bag_helper.data_bags @scm = Bagboy::Core::SCMHelper.instance end private def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end helper_method :current_user def authorize if !session_whitelist? redirect_to bagboy_signin_path unless current_user end end def session_whitelist? return true if params[:controller] == 'bagboy/sessions' if params[:controller] == 'bagboy/users' return true if Bagboy::User.count == 0 and (params[:action] == 'new' or params[:action] == 'create') end false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bagboy-0.0.1 | app/controllers/bagboy/application_controller.rb |