Project

General

Profile

Actions

Bug #24056

closed

Permissions fail when connected to Facets

Added by Partha Aji about 6 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Users, Roles and Permissions
Target version:
-
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Consider the following steps
  1. create a role with the following filters -> [ :view_facts, (:view_hosts, :search => "content_view_id = 1")] note I used content_view_id as the search filter for the host. You could use any facet attribute for this.
  2. create a user associated to this role
  3. execute api call
  4. curl -s -u 'apiuser:redhat' -k https://<url>/api/v2/hosts/3/facts

Expected:
Assuming Host with id 3 is associated to cv 1, we should get the facts

Actual:
$ curl -s -u 'apiuser:redhat' -k https://<url>/api/v2/hosts/3/facts
{
  "error": {"message":"Can't join 'Host::Base' to association named 'content_facet'; perhaps you misspelled it?"}
}

Problem here is with this call -> https://github.com/theforeman/foreman/blob/develop/app/services/authorizer.rb#L62

Basically the code does the equivalent of

> FactValue.joins(:host => :content_facet).to_sql
ActiveRecord::ConfigurationError: Can't join 'Host::Base' to association named 'content_facet'; perhaps you misspelled it?

Any facet attribute associated to the host is going to hit this issue.

Actions #1

Updated by Partha Aji about 6 years ago

  • Bugzilla link set to 1569395
Actions #2

Updated by The Foreman Bot about 6 years ago

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

Updated by Partha Aji about 6 years ago

  • Assignee changed from Partha Aji to Shimon Shtein
  • Triaged set to No
Actions #4

Updated by The Foreman Bot about 6 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5837 added
Actions #5

Updated by Anonymous almost 6 years ago

  • Fixed in Releases 1.20.0 added
Actions #6

Updated by Shimon Shtein almost 6 years ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by Eric Helms almost 6 years ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/5739)
Actions #8

Updated by The Foreman Bot almost 6 years ago

  • Pull request https://github.com/theforeman/foreman/pull/6110 added
Actions #9

Updated by Eric Helms over 5 years ago

  • Pull request deleted (https://github.com/theforeman/foreman/pull/6110)
Actions #10

Updated by Tomer Brisker about 4 years ago

  • Category changed from 218 to Users, Roles and Permissions
Actions

Also available in: Atom PDF