Project

General

Profile

« Previous | Next » 

Revision 3061e381

Added by Ohad Levy over 11 years ago

  • ID 3061e381a1eedeaa66f141fa198c39e12f84c05b

fixes #2084 - All Facts and Reports are visible regardless of selected Org/Location for admin users

View differences:

app/models/fact_value.rb
:conditions => ["fact_names.name = ?",:_timestamp]
scope :my_facts, lambda {
return { :conditions => "" } if User.current.admin? # Admin can see all hosts
{:conditions => sanitize_sql_for_conditions(
[" (fact_values.host_id in (?))",Host.my_hosts.pluck(:id)])}
if User.current.admin? and Organization.current.nil? and Location.current.nil?
{ :conditions => "" }
else
#TODO: Remove pluck after upgrade to newer rails as it would be
#done via INNER select automatically
where(:fact_values => {:host_id => Host.my_hosts.pluck(:id)})
end
}
scope :distinct, { :select => 'DISTINCT "fact_values.value"' }

Also available in: Unified diff