Forked from hortongn/gist:b842074c8a3cfb0a0c09c6bce4e5e80a
Created
January 19, 2020 04:09
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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