Sha256: ffac203a181dc593253846c9694447aec4f2baa57d803f902b2cf49ffd6c6a33

Contents?: true

Size: 791 Bytes

Versions: 30

Compression:

Stored size: 791 Bytes

Contents

require 'pact_broker/configuration'

module PactBroker
  class DefaultPolicy
    def initialize(current_user, resource)
      @current_user = current_user
      @resource = resource
    end

    def update?
      true
    end

    def delete?
      true
    end

    def create?
      true
    end

    def view?
      true
    end

    private

    attr_reader :current_user, :resource

    class Scope
      def initialize(user, scope)
        @user = user
        @scope = scope
      end

      def resolve
        scope
      end

      private

      attr_reader :user, :scope
    end
  end

  def self.policy!(*args)
    PactBroker.configuration.policy_builder.call(*args)
  end

  def self.policy_scope!(*args)
    PactBroker.configuration.policy_scope_builder.call(*args)
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
pact_broker-2.79.1 lib/pact_broker/policies.rb
pact_broker-2.79.0 lib/pact_broker/policies.rb
pact_broker-2.78.1 lib/pact_broker/policies.rb
pact_broker-2.78.0 lib/pact_broker/policies.rb
pact_broker-2.77.0 lib/pact_broker/policies.rb
pact_broker-2.76.2 lib/pact_broker/policies.rb
pact_broker-2.76.1 lib/pact_broker/policies.rb
pact_broker-2.76.0 lib/pact_broker/policies.rb
pact_broker-2.75.0 lib/pact_broker/policies.rb
pact_broker-2.74.1 lib/pact_broker/policies.rb
pact_broker-2.74.0 lib/pact_broker/policies.rb
pact_broker-2.73.0 lib/pact_broker/policies.rb
pact_broker-2.72.0 lib/pact_broker/policies.rb
pact_broker-2.71.0 lib/pact_broker/policies.rb
pact_broker-2.70.0 lib/pact_broker/policies.rb
pact_broker-2.69.0 lib/pact_broker/policies.rb
pact_broker-2.68.1 lib/pact_broker/policies.rb
pact_broker-2.68.0 lib/pact_broker/policies.rb
pact_broker-2.67.0 lib/pact_broker/policies.rb
pact_broker-2.66.0 lib/pact_broker/policies.rb