Sha256: daaf138f90d7bee7be734a96c8c46266352b84ca393feabaf260c5451ad61c72

Contents?: true

Size: 654 Bytes

Versions: 3

Compression:

Stored size: 654 Bytes

Contents

module Cas
  class ApplicationController < ActionController::Base
    protect_from_forgery with: :exception
    before_action :authenticate_user!
    before_action :set_current_user
    before_action :set_user_sites
    before_action :set_domain

    private

    def set_current_user
      @current_user = current_user
    end

    def set_user_sites
      @user_sites = @current_user.sites if @current_user.present?
    end

    def set_domain
      @domain ||= (ENV["DOMAIN"] || request.domain)

      if @domain.blank? || (ENV["DOMAIN"].blank? && @domain == "localhost")
        @domain = ::Cas::Site.first!.domains.first
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cas-cms-0.1.3 app/controllers/cas/application_controller.rb
cas-cms-0.1.2 app/controllers/cas/application_controller.rb
cas-cms-0.1.1 app/controllers/cas/application_controller.rb