add new data from NCCU

This commit is contained in:
Matthew K. Fu JuYuan 2012-10-09 14:40:28 +08:00
parent 89b1aace8a
commit d027cf8e6a
1 changed files with 25 additions and 0 deletions

View File

@ -59,4 +59,29 @@ namespace :nccu do
end 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 end