Sha256: 8c0f1dfe02ebe56fd692283916f4c6541ab7f0d176e8631bc636223ddaadbc5e

Contents?: true

Size: 806 Bytes

Versions: 11

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  module Forms
    ##
    # Nested form for permissions.
    #
    # @note due to historical oddities with Hydra::AccessControls and Hydra
    #   Editor, Hyrax's views rely on `agent_name` and `access` as field
    #   names. we provide these as virtual fields and prepopulate these from
    #   `Hyrax::Permission`.
    class Permission < Hyrax::ChangeSet
      property :agent_name, virtual: true, prepopulator: ->(_opts) { self.agent_name = model.agent }
      property :access, virtual: true, prepopulator: ->(_opts) { self.access = model.mode }

      ##
      # @note support a {#to_hash} method for compatibility with
      #   {Hydra::AccessControl::Permissions}
      def to_hash
        { name: agent_name, access: access }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
hyrax-3.6.0 app/forms/hyrax/forms/permission.rb
hyrax-4.0.0.rc1 app/forms/hyrax/forms/permission.rb
hyrax-3.5.0 app/forms/hyrax/forms/permission.rb
hyrax-4.0.0.beta2 app/forms/hyrax/forms/permission.rb
hyrax-3.4.2 app/forms/hyrax/forms/permission.rb
hyrax-4.0.0.beta1 app/forms/hyrax/forms/permission.rb
hyrax-3.4.1 app/forms/hyrax/forms/permission.rb
hyrax-3.4.0 app/forms/hyrax/forms/permission.rb
hyrax-3.3.0 app/forms/hyrax/forms/permission.rb
hyrax-3.2.0 app/forms/hyrax/forms/permission.rb
hyrax-3.1.0 app/forms/hyrax/forms/permission.rb