Revision 5ddb3741
Added by Marek Hulán about 9 years ago
app/models/host/managed.rb | ||
---|---|---|
attr_reader :cached_host_params
|
||
|
||
default_scope lambda {
|
||
org = Organization.current
|
||
loc = Location.current
|
||
org = Organization.expand(Organization.current)
|
||
loc = Location.expand(Location.current)
|
||
conditions = {}
|
||
conditions[:organization_id] = org.subtree_ids if org
|
||
conditions[:location_id] = loc.subtree_ids if loc
|
||
conditions[:organization_id] = Array(org).map {|o| o.subtree_ids }.flatten.uniq if org.present?
|
||
conditions[:location_id] = Array(loc).map {|l| l.subtree_ids }.flatten.uniq if loc.present?
|
||
where(conditions)
|
||
}
|
||
|
Also available in: Unified diff
Fixes #9947 - restrict user taxonomies if none is set
(cherry picked from commit abe910f2a46f4ecc1f349263d0b4751ed46ff200)