Sha256: efc925e1759c12c8066d7fe6aba71880608d54f18dd65198a05cda77e8463cb9

Contents?: true

Size: 868 Bytes

Versions: 57

Compression:

Stored size: 868 Bytes

Contents

module Cmor::Rbac
  module Backend
    class ImportDefaultPermissionsServiceController < Cmor::Core::Backend::ServiceController::Base
      before_action :load_filenames, only: [:new, :create]

      def self.service_class
        Cmor::Rbac::ImportDefaultPermissionsService
      end

      private

      def permitted_params
        params.require(:import_default_permissions_service).permit(:filename)
      end

      def load_filenames
        @filenames = ::Rails::Engine.subclasses.map(&:instance).collect do |engine|
          filename = engine.root.join *%w(config rbac.yml)
          next unless File.readable? filename
          filename
        end.compact

        @filenames << application_filename if File.readable? application_filename
      end

      def application_filename
        Rails.root.join *%w(config rbac.yml)
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
cmor_rbac_backend-0.0.17.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.16.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.15.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.14.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.13.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.12.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.11.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.10.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.9.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.8.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.7.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.6.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.5.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.4.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.3.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.2.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb
cmor_rbac_backend-0.0.1.pre app/controllers/cmor/rbac/backend/import_default_permissions_service_controller.rb