Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jayanthdeejay/9b15dcf6803d2894dd77d8d4d5e5e05d to your computer and use it in GitHub Desktop.
Save jayanthdeejay/9b15dcf6803d2894dd77d8d4d5e5e05d to your computer and use it in GitHub Desktop.
Find all works in a collection and update the editors for each work
c = Collection.find('d504rk335')
work_ids = []
c.member_objects.each do |member|
work_ids << member.id
end
new_edit_users = ["user1@example.com", "user2@example.com"]
def change_edit_users(work_ids, new_edit_users)
work_ids.each do |pid|
work = ActiveFedora::Base.find(pid)
work.edit_users = new_edit_users
work.save
work.file_sets.each do |file|
file.edit_users = new_edit_users
file.save
end
end
end
change_edit_users(work_ids, new_edit_users)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment