fix object auth without app_auth

This commit is contained in:
Matthew K. Fu JuYuan committed 2012-10-16 14:23:44 +08:00
1 parent d027cf8e6a
commit 6dfe10040b
6 files changed
+29 -14

No files matched your search

+15 -3
View File
@@ -78,10 +78,22 @@ namespace :nccu do
end
task :add_nccu_account_1016 => :environment do
a = ["waynedd@nccu.edu.tw","sfchang@nccu.edu.tw","kyokolin@nccu.edu.tw","sfaylin@nccu.edu.tw","jinyulin@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
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