Sha256: 59292a8d5d293f583230c44431b6fe1865c3f76b5a4fd99429a8202ff018425e
Contents?: true
Size: 603 Bytes
Versions: 34
Compression:
Stored size: 603 Bytes
Contents
module Ddr module Auth class CollectionAbilityDefinitions < AbilityDefinitions def call if member_of? Ddr::Auth.collection_creators_group can :create, ::Collection end can :export, ::Collection do |obj| has_policy_permission?(obj, Permissions::READ) end end private def policy_permissions(obj) obj.roles .in_policy_scope .agent(agents) .permissions end def has_policy_permission?(obj, perm) policy_permissions(obj).include?(perm) end end end end
Version data entries
34 entries across 34 versions & 1 rubygems