Sha256: 67cf75663be7f8dfdcb6b546c3911d6079b5a22d573732ef83808ca63e86cd08

Contents?: true

Size: 663 Bytes

Versions: 4

Compression:

Stored size: 663 Bytes

Contents

module Spree
	module Admin
    class RolesController < ResourceController
      before_filter :load_permissions, :only => [:edit, :new, :create, :update]
      before_filter :restrict_unless_editable, :only => [:edit, :update]

      def index
        @roles = Spree::Role.page(params[:page])
      end

      private
        def permitted_resource_params
          params.require(:role).permit(:name, :permission_ids => [])
        end

        def load_permissions
          @permissions = Spree::Permission.visible.all
        end

        def restrict_unless_editable
          redirect_to admin_roles_path unless @role.editable?
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_admin_roles_and_access-1.3.0 app/controllers/spree/admin/roles_controller.rb
spree_admin_roles_and_access-1.2.1 app/controllers/spree/admin/roles_controller.rb
spree_admin_roles_and_access-1.2.0 app/controllers/spree/admin/roles_controller.rb
spree_admin_roles_and_access-1.1.0 app/controllers/spree/admin/roles_controller.rb