Proof authed_users for case when no category

This commit is contained in:
Christophe Vilayphiou 2012-05-18 10:50:51 +08:00
parent 8ad7f70822
commit d9c12ea5a4
5 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@ defaults: &defaults
development:
<<: *defaults
database: prototype_r4_development
database: prototype_r4_ldap0229
test:
<<: *defaults
@ -22,4 +22,4 @@ production:
# password: <%= ENV['MONGOID_PASSWORD'] %>
# database: <%= ENV['MONGOID_DATABASE'] %>
<<: *defaults
database: prototype_r4_development
database: prototype_r4_ldap0229

View File

@ -45,7 +45,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
if(!is_admin? || !is_manager?)
@bulletins.delete_if{ |bulletin|
bulletin.is_pending == true && (!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || bulletin.create_user_id!=current_user.id)
bulletin.is_pending == true && ((!bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) || bulletin.create_user_id!=current_user.id)
}
end

View File

@ -2,7 +2,7 @@ module Panel::Announcement::BackEnd::BulletinsHelper
def show_approval_link(bulletin)
by_bulletin = (!bulletin.is_expired? and !bulletin.is_checked?)
by_user = (bulletin.bulletin_category.authed_users('fact_check').include?(current_user) or is_manager? or is_admin?)
by_user = ((bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager? or is_admin?)
by_bulletin and by_user
end

View File

@ -43,7 +43,7 @@ class Panel::News::BackEnd::NewsBulletinsController < OrbitBackendController
@link_url = panel_news_back_end_news_bulletins_path
@news_bulletins.delete_if{ |news_bulletin|
news_bulletin.is_pending == true && (!news_bulletin.bulletin_category.authed_users('fact_check').include?(current_user) || news_bulletin.create_user_id!=current_user.id)
news_bulletin.is_pending == true && ((!news_bulletin.bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) || news_bulletin.create_user_id!=current_user.id)
}
@news_bulletin_file = NewsBulletinFile.new

View File

@ -2,7 +2,7 @@ module Panel::News::BackEnd::NewsBulletinsHelper
def news_show_approval_link(news_bulletin)
by_news_bulletin = (!news_bulletin.is_expired? and !news_bulletin.is_checked?)
by_user = news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) or is_manager?
by_user = (news_bulletin.news_bulletin_category.authed_users('fact_check').include?(current_user) rescue nil) or is_manager?
by_news_bulletin and by_user
end