Sha256: 949e7fa9cf74696d9d411f1ffd2352ecdec69b75502cf50ba8244e587fbaa01f

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

# frozen_string_literal: true

module Distribuo
  class ApplicationPolicy
    attr_reader :user, :record

    def initialize(user, record)
      @user = user
      @record = record
    end

    def index?
      true
    end

    def show?
      true
    end

    def create?
      true
    end

    def new?
      create?
    end

    def update?
      true
    end

    def edit?
      update?
    end

    def destroy?
      false
    end

    def event?
      update?
    end

    class Scope
      attr_reader :user, :scope

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

      def resolve
        scope.administrable
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
distribuo-0.1.16 app/policies/distribuo/application_policy.rb
distribuo-0.1.8 app/policies/distribuo/application_policy.rb