Sha256: 8366b2892c63b9adfa24546c42a25eca61a90a1af1ffb251eae93caf2d1acc0c

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

module Checkpoint
  class Resource
    # Specialized Resource type to represent all entities of a any/all types.
    # This is used for zone-/system-wide grants or checks.
    class AllOfAnyType < Resource
      # Create a wildcard Resource.
      #
      # Because type and ID are static, this takes no parameters
      def initialize
        @entity = AnyEntity.new
      end

      # Create a wildcard Resource "from" an entity. The entity disregarded and
      # {AnyEntity} is substituted.
      #
      # @return [AllOfAnyType] a wildcard Resource instance
      def self.from(_entity)
        new
      end

      # The special ALL type
      def type
        Resource::ALL
      end

      # The special ALL id
      def id
        Resource::ALL
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
checkpoint-1.0.3 lib/checkpoint/resource/all_of_any_type.rb
checkpoint-1.0.2 lib/checkpoint/resource/all_of_any_type.rb
checkpoint-1.0.1 lib/checkpoint/resource/all_of_any_type.rb
checkpoint-1.0.0 lib/checkpoint/resource/all_of_any_type.rb