From 65527017cabb6389415e4b32224e818e89fb22d3 Mon Sep 17 00:00:00 2001 From: chris Date: Tue, 2 Jul 2013 17:26:02 +0800 Subject: [PATCH] Update new UI task to migrate the authorizations. PS: sold must be running for new_ui.rake --- lib/tasks/new_ui.rake | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/tasks/new_ui.rake b/lib/tasks/new_ui.rake index 5316c7c3..82c75207 100644 --- a/lib/tasks/new_ui.rake +++ b/lib/tasks/new_ui.rake @@ -46,6 +46,20 @@ namespace :new_ui do object.save end end + if object_auths = ObjectAuth.where(obj_authable_type: "#{category_name.classify}Category") + object_auths.each do |object_auth| + case object_auth.title + when 'fact_check' + new_object_auth = new_category.get_object_auth_by_title("approval_#{module_app.key}") + else + new_object_auth = new_category.get_object_auth_by_title("submit_#{module_app.key}") + end + object_auth.auth_users.each do |user| + new_object_auth.add_user_to_privilege_list(user) + end + object_auth.destroy + end + end category.destroy end end