Module: RightsRestrictionNotes::Implementation

Defined in:
backend/app/model/mixins/rights_restriction_notes.rb

Class Method Summary collapse

Class Method Details

.process_restriction_notes(json, obj) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'backend/app/model/mixins/rights_restriction_notes.rb', line 40

def self.process_restriction_notes(json, obj)
  obj.rights_restriction_dataset.delete

  restrictions = ASUtils.wrap(json['notes']).each do |note|
    next unless note['jsonmodel_type'] == 'note_multipart' && RESTRICTION_NOTE_TYPES.include?(note['type'])
    next unless note.has_key?('rights_restriction')

    restriction = obj.add_rights_restriction(:begin => note['rights_restriction']['begin'],
                                             :end => note['rights_restriction']['end'],
                                             :restriction_note_type => note['type'])

    ASUtils.wrap(note['rights_restriction']['local_access_restriction_type']).each do |restriction_type|
      restriction.add_rights_restriction_type(:restriction_type => restriction_type)
    end
  end
end