theforeman/foreman_discovery — pull request #82 by GregSutcliffe (2014-08-07 11:36:17+00:00)
Title: Develop

Also drops the last use of Deface! :clap:

There's a minor issue with Taxonomies. If I have a non-admin user with :view_discovered_hosts, and 8 discovered hosts, 2 of which are in the user's taxonomies, then the widget displays correctly, but the discovered_hosts index does not. The log shows:

```
Filter Load (0.3ms) SELECT DISTINCT "filters".* FROM "filters" INNER JOIN "filterings" ON "filterings"."filter_id" = "filters"."id" INNER JOIN "permissions" ON "permissions"."id" = "filterings"."permission_id" INNER JOIN "roles" ON "filters"."role_id" = "roles"."id" INNER JOIN "cached_user_roles" ON "roles"."id" = "cached_user_roles"."role_id" LEFT JOIN taxable_taxonomies ON (filters.id = taxable_taxonomies.taxable_id AND taxable_type = 'Filter') LEFT JOIN taxonomies ON (taxonomies.id = taxable_taxonomies.taxonomy_id) WHERE "cached_user_roles"."user_id" = 3 AND (permissions.resource_type = 'Host') AND (permissions.name = 'view_discovered_hosts') AND (taxable_taxonomies.id IS NULL OR (taxonomies.type = 'Organization') OR (taxonomies.type = 'Location')) ORDER BY role_id, filters.id
CACHE (0.0ms) SELECT id FROM "taxonomies" WHERE (taxonomies.id = 4 or taxonomies.ancestry like '4/%' or taxonomies.ancestry = '4') ORDER BY title
CACHE (0.0ms) SELECT id FROM "taxonomies" WHERE (taxonomies.id = 3 or taxonomies.ancestry like '3/%' or taxonomies.ancestry = '3') ORDER BY title
Host::Discovered Load (0.3ms) SELECT "hosts".* FROM "hosts" WHERE "hosts"."organization_id" IN (4) AND "hosts"."location_id" IN (3) AND "hosts"."type" IN ('Host::Discovered') AND (1=0) ORDER BY "hosts"."name" ASC LIMIT 20 OFFSET 0
```

Seems like the resource_type is wrong in the first line? @ares @elobato any ideas? I'm debating whether to care, discovered hosts are usually global anyway...