Revision 1e611cee
Added by Dominic Cleal about 9 years ago
app/models/report.rb | ||
---|---|---|
# returns reports for hosts in the User's filter set
|
||
scope :my_reports, lambda {
|
||
unless User.current.admin? and Organization.current.nil? and Location.current.nil?
|
||
where(:reports => {:host_id => Host.authorized(:view_hosts, Host)})
|
||
host_ids = Host.authorized(:view_hosts, Host).select("hosts.id").all
|
||
where(:reports => {:host_id => host_ids})
|
||
end
|
||
}
|
||
|
Also available in: Unified diff
refs #8817 - Revert "fixes #5841 - use inner query when retrieving reports for subset of authorised hosts"
This reverts commit ecdb85a84915954f312889ba51a9b35de86cd38c.