Sha256: 2e2d5857f0420d31a2b8c877595a7c41f7535503a4c7b390a5ba21529c913170

Contents?: true

Size: 907 Bytes

Versions: 14

Compression:

Stored size: 907 Bytes

Contents

module RailsAdminImageManager
  class ApplicationController < ActionController::Base

    protect_from_forgery with: :exception

    before_action :_authenticate!
    before_action :_authorize!
    before_action :_check_permissions

    def _current_user
      instance_eval(&RailsAdmin::Config.current_user_method)
    end

   private

    def _authenticate!
      instance_eval(&RailsAdmin::Config.authenticate_with)
    end

    def _authorize!
      instance_eval(&RailsAdmin::Config.authorize_with)
    end

    def _check_permissions(action=:read)
      @authorization_adapter.try(:authorize, action, file_model)
    end

    def file_model
      RailsAdmin::AbstractModel.new(to_model_name("::RailsAdminImageManager::File"))
    end

    def to_model_name(param)
      param.split('~').collect(&:camelize).join('::')
    end

    def filter_by?(param)
      params[param].present?
    end

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rails_admin_image_manager-0.1.34 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.33 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.31 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.30 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.3 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.29 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.28 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.27 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.26 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.25 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.24 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.23 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.22 app/controllers/rails_admin_image_manager/application_controller.rb
rails_admin_image_manager-0.1.21 app/controllers/rails_admin_image_manager/application_controller.rb