Sha256: 2f014bd678a16c81e4c45b2fe718e2ebb0adaa323cc2fc991ea33387b70bf008
Contents?: true
Size: 851 Bytes
Versions: 1
Compression:
Stored size: 851 Bytes
Contents
# frozen_string_literal: true module Checkpoint class Resource # A Resource Resolver takes a concrete object (like a model instance) and # resolves it into all {Resource}s for which a permit would allow an action. # For example, this can be used to grant a credential on all items of a given # model class or to implement cascading permissions when all credentials for # a container should apply to the contained objects. # # NOTE: This implementation currently always resolves to the entity and its # type and nothing more. This needs some thought on an appropriate extension # mechanism to mirror the {PermissionMapper}. class Resolver def resolve(target) return [target] if target.is_a?(Resource) [Resource.from(target), Resource::AllOfType.from(target)] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
checkpoint-1.0.0 | lib/checkpoint/resource/resolver.rb |