From d027cf8e6a6ccc7cc518b9d3b38be98399dde8bc Mon Sep 17 00:00:00 2001 From: "Matthew K. Fu JuYuan" Date: Tue, 9 Oct 2012 14:40:28 +0800 Subject: [PATCH] add new data from NCCU --- lib/tasks/nccu.rake | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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