Bug 1506253
| Summary: | [Hammer] PG::Error while non-admin user listing entities in default location | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Jitendra Yejare <jyejare> |
| Component: | Users & Roles | Assignee: | Ondřej Pražák <oprazak> |
| Status: | CLOSED ERRATA | QA Contact: | Peter Ondrejka <pondrejk> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.3.0 | CC: | dhlavacd, mhulan, oprazak |
| Target Milestone: | 6.4.0 | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2018-10-16 19:01:15 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1373844 | ||
The important part of the reproducer is that role must be assigned to location. After unassigning it works. Created redmine issue http://projects.theforeman.org/issues/21871 from this bug Upstream bug assigned to oprazak I was able to reproduce on latest 6.3, the easy workaround seems to be
> hammer -u orgadmin -p changeme subnet list --search 'location_id = 2'
it's not fixed by the recent scoped_search fix (testing with 4.1.2). For some reason, it tries to load locations_subnets table so it ignores polymorphic association. I was also able to reproduce upstream.
*** Bug 1491317 has been marked as a duplicate of this bug. *** Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21871 has been resolved. Verified on sat 6.4 snap 6 Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2018:2927 |
Description of problem: PG Error when non-admin user attempt to list the entities(especially hostgroup, subnet, domain etc.) in the default location. Also, the default location is assigned to the user and its role. Version-Release number of selected component (if applicable): Satellite 6.3 snap 21 How reproducible: Always Steps to Reproduce: 1. Create role(in my case org admin role) with permissions to above entities listed in description 2. Assign default organization and location to that role 3. Create non admin user and assign above role 4. Assign default org and loc to above user 5. Attempt to list entities(especially subnet, domain etc.) from above user using hammer Actual results: #hammer subnet list --location-id 2 PG::Error: ERROR: missing FROM-clause entry for table "locations_subnets" LINE 1: ...ncestry" AS t1_r8, "taxonomies"."title" AS t1_r9, "locations... ^ : SELECT "subnets"."id" AS t0_r0, "subnets"."network" AS t0_r1, "subnets"."mask" AS t0_r2, "subnets"."priority" AS t0_r3, "subnets"."name" AS t0_r4, "subnets"."vlanid" AS t0_r5, "subnets"."created_at" AS t0_r6, "subnets"."updated_at" AS t0_r7, "subnets"."dhcp_id" AS t0_r8, "subnets"."tftp_id" AS t0_r9, "subnets"."gateway" AS t0_r10, "subnets"."dns_primary" AS t0_r11, "subnets"."dns_secondary" AS t0_r12, "subnets"."from" AS t0_r13, "subnets"."to" AS t0_r14, "subnets"."dns_id" AS t0_r15, "subnets"."boot_mode" AS t0_r16, "subnets"."ipam" AS t0_r17, "subnets"."discovery_id" AS t0_r18, "subnets"."type" AS t0_r19, "taxonomies"."id" AS t1_r0, "taxonomies"."name" AS t1_r1, "taxonomies"."type" AS t1_r2, "taxonomies"."created_at" AS t1_r3, "taxonomies"."updated_at" AS t1_r4, "taxonomies"."ignore_types" AS t1_r5, "taxonomies"."description" AS t1_r6, "taxonomies"."label" AS t1_r7, "taxonomies"."ancestry" AS t1_r8, "taxonomies"."title" AS t1_r9, "locations_subnets"."id" AS t2_r0, "locations_subnets"."name" AS t2_r1, "locations_subnets"."type" AS t2_r2, "locations_subnets"."created_at" AS t2_r3, "locations_subnets"."updated_at" AS t2_r4, "locations_subnets"."ignore_types" AS t2_r5, "locations_subnets"."description" AS t2_r6, "locations_subnets"."label" AS t2_r7, "locations_subnets"."ancestry" AS t2_r8, "locations_subnets"."title" AS t2_r9, "smart_proxies"."id" AS t3_r0, "smart_proxies"."name" AS t3_r1, "smart_proxies"."url" AS t3_r2, "smart_proxies"."created_at" AS t3_r3, "smart_proxies"."updated_at" AS t3_r4, "smart_proxies"."pubkey" AS t3_r5, "smart_proxies"."expired_logs" AS t3_r6, "smart_proxies"."puppet_path" AS t3_r7, "smart_proxies"."download_policy" AS t3_r8, "dhcps_subnets"."id" AS t4_r0, "dhcps_subnets"."name" AS t4_r1, "dhcps_subnets"."url" AS t4_r2, "dhcps_subnets"."created_at" AS t4_r3, "dhcps_subnets"."updated_at" AS t4_r4, "dhcps_subnets"."pubkey" AS t4_r5, "dhcps_subnets"."expired_logs" AS t4_r6, "dhcps_subnets"."puppet_path" AS t4_r7, "dhcps_subnets"."download_policy" AS t4_r8, "dns_subnets"."id" AS t5_r0, "dns_subnets"."name" AS t5_r1, "dns_subnets"."url" AS t5_r2, "dns_subnets"."created_at" AS t5_r3, "dns_subnets"."updated_at" AS t5_r4, "dns_subnets"."pubkey" AS t5_r5, "dns_subnets"."expired_logs" AS t5_r6, "dns_subnets"."puppet_path" AS t5_r7, "dns_subnets"."download_policy" AS t5_r8 FROM "subnets" INNER JOIN "taxable_taxonomies" ON "taxable_taxonomies"."taxable_id" = "subnets"."id" AND "taxable_taxonomies"."taxable_type" = $1 INNER JOIN "taxonomies" ON "taxonomies"."id" = "taxable_taxonomies"."taxonomy_id" AND "taxonomies"."type" = $2 LEFT OUTER JOIN "taxable_taxonomies" "taxable_taxonomies_subnets_join" ON "taxable_taxonomies_subnets_join"."taxable_id" = "subnets"."id" AND "taxable_taxonomies_subnets_join"."taxable_type" = $3 LEFT OUTER JOIN "taxonomies" "organizations_subnets" ON "organizations_subnets"."id" = "taxable_taxonomies_subnets_join"."taxonomy_id" AND "organizations_subnets"."type" = $4 LEFT OUTER JOIN "smart_proxies" ON "smart_proxies"."id" = "subnets"."tftp_id" AND (smart_proxies.id IN (1,2)) LEFT OUTER JOIN "smart_proxies" "dhcps_subnets" ON "dhcps_subnets"."id" = "subnets"."dhcp_id" AND (smart_proxies.id IN (1,2)) LEFT OUTER JOIN "smart_proxies" "dns_subnets" ON "dns_subnets"."id" = "subnets"."dns_id" AND (smart_proxies.id IN (1,2)) WHERE (subnets.id IN (2)) AND ((("subnets"."id" IN (SELECT "subnets"."id" FROM "subnets" INNER JOIN "taxable_taxonomies" ON "subnets"."id" = "taxable_taxonomies"."taxable_id" AND taxable_type = 'Subnet' INNER JOIN "taxonomies" ON "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" WHERE "taxonomies"."id" = '1' )) AND ("subnets"."id" IN (SELECT "subnets"."id" FROM "subnets" INNER JOIN "taxable_taxonomies" ON "subnets"."id" = "taxable_taxonomies"."taxable_id" AND taxable_type = 'Subnet' INNER JOIN "taxonomies" ON "taxable_taxonomies"."taxonomy_id" = "taxonomies"."id" WHERE "taxonomies"."id" = '2' )))) AND (subnets.id IN (2)) AND "taxonomies"."type" IN ('Location') AND ("taxonomies"."id" = 2 OR "taxonomies"."title" = '2') AND "subnets"."id" IN (2) ORDER BY vlanid, "taxonomies"."title" ASC, CASE WHEN "taxonomies"."title" = '2' THEN 1 ELSE 0 END Expected results: List of entities should be displayed without any error. Additional info: