Project

General

Profile

Actions

Bug #21871

closed

[Hammer] PG::Error while non-admin user listing entities in default location

Added by Ondřej Pražák almost 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Target version:
Fixed in Releases:
Found in Releases:

Description

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.

How reproducible:
Always

Steps to Reproduce:
1. Create a role with permissions to above entities listed in description
2. Assign organization and location to that role
3. Create non admin user and assign above role
4. Assign default org and loc to above user, same as were assigned to the role
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:


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #24712: Foreman (1.18?) slow API call against fact_values endpointClosedTomer BriskerActions
Actions #1

Updated by Ondřej Pražák almost 7 years ago

  • Subject changed from [Hammer] PG::Error while non-admin user listing entities in default location to [Hammer] PG::Error while non-admin user listing entities in default location
  • Assignee set to Ondřej Pražák
Actions #2

Updated by The Foreman Bot almost 7 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/5071 added
Actions #3

Updated by Marek Hulán almost 7 years ago

  • Translation missing: en.field_release set to 330
Actions #4

Updated by Ondřej Pražák almost 7 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #5

Updated by The Foreman Bot almost 7 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5226 added
Actions #6

Updated by Luke Alexander over 6 years ago

  • Related to Bug #24712: Foreman (1.18?) slow API call against fact_values endpoint added
Actions

Also available in: Atom PDF