Sha256: 83d21660a6f7ca9563d8c56dd08f4b5221e26203cf048886149a49fd0626cb20

Contents?: true

Size: 765 Bytes

Versions: 1

Compression:

Stored size: 765 Bytes

Contents

module Sufia
  module Export
    # Convert a permission record from a ActiveFedora:Base into a PORO so that the metadata
    #  can be exported in json format using to_json
    #
    class PermissionConverter
      # Create an instance of a Object Permission containing all the metadata for the permission
      #
      # @param [Hydra::AccessControls::Permission] permission the permission associated with one access record
      def initialize(permission)
        @id = permission.id
        @agent = permission.agent.first.rdf_subject.to_s
        @mode = permission.mode.first.rdf_subject.to_s
        # Using .id instead of .uri allows us to rebuild the URI later on with a new base URI
        @access_to = permission.access_to.id
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sufia-6.7.0 lib/sufia/export/permission_converter.rb