Users: add Contributor and Approver user levels
This commit is contained in:
17
script/fixes/122_populate_approvers_and_contributors.rb
Executable file
17
script/fixes/122_populate_approvers_and_contributors.rb
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require_relative "base"
|
||||
|
||||
with_confirmation do
|
||||
User.where(level: User::Levels::BUILDER).bit_prefs_match(:_unused_can_upload_free, true).bit_prefs_match(:_unused_can_approve_posts, false).find_each do |contributor|
|
||||
contributor.level = User::Levels::CONTRIBUTOR
|
||||
contributor.save
|
||||
puts "user ##{contributor.id} #{contributor.name} updated to contributor"
|
||||
end
|
||||
|
||||
User.where(level: User::Levels::BUILDER).bit_prefs_match(:_unused_can_approve_posts, true).find_each do |approver|
|
||||
approver.level = User::Levels::APPROVER
|
||||
approver.save
|
||||
puts "user ##{contributor.id} #{approver.name} updated to approver"
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user