diff --git a/lib/tasks/nccu.rake b/lib/tasks/nccu.rake index 5c20f27c..8cae04e2 100644 --- a/lib/tasks/nccu.rake +++ b/lib/tasks/nccu.rake @@ -59,4 +59,29 @@ namespace :nccu do end + task :add_nccu_account_1009 => :environment do + a = ["blannytg@nccu.edu.tw","yucca@nccu.edu.tw","fish14@nccu.edu.tw","amanda13@nccu.edu.tw"] + users_ary = User.any_in(email: a) + NewsBulletinCategory.all.each do |cate| + oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "NewsBulletinCategory",obj_authable_id: cate.id}}) + oa.privilege_users = oa.privilege_users + users_ary + oa.save + end + + a=["annieayu@nccu.edu.tw","blannytg@nccu.edu.tw","yucca@nccu.edu.tw","amanda13@nccu.edu.tw"] + users_ary = User.any_in(email: a) + key = 'Announcement' + bc = BulletinCategory.first({conditions:{key: key}}) + oa = ObjectAuth.first({conditions:{title: "submit",obj_authable_type: "BulletinCategory",obj_authable_id: bc.id}}) + oa.privilege_users = oa.privilege_users + users_ary + oa.save + + end + + + + + + + end \ No newline at end of file