Project

General

Profile

Actions

Bug #18690

closed

Cannot query most auditable_types in API

Added by Tomáš Strachota about 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Search
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1426742

When a user edits an authentication source and audit record such as this is generated:

{
  "user_id": 3,
  "user_type": null,
  "user_name": "admin",
  "version": 1,
  "comment": null,
  "associated_id": null,
  "associated_type": null,
  "remote_address": "192.168.0.0",
  "associated_name": null,
  "created_at": "2016-11-30 15:41:19 UTC",
  "id": 12417,
  "auditable_id": 3,
  "auditable_name": "LDAP-GBL-AD",
  "auditable_type": "AuthSource",
  "action": "create",
  "audited_changes": {
    "name": "GBL-AD",
    "host": <hostname>,
    "port": 389,
    "account": null,
    "account_password": null,
    "base_dn": null,
    "attr_login": "sAMAccountName",
    "attr_firstname": "givenName",
    "attr_lastname": "sn",
    "attr_mail": "userPrincipalName",
    "onthefly_register": true,
    "tls": false,
    "ldap_filter": null,
    "attr_photo": null,
    "server_type": "posix",
    "groups_base": null,
    "usergroup_sync": false
  }
}

And the audit event with is recorded with auditable_type = AuthSource. However, this fails:

https://satellite.example.com/api/v2/audits/?search=name=AuthSource

With this (by name):

  "error": {"message":"Field 'name' not recognized for searching!","class":"ScopedSearch::QueryNotSupported"}

But when you query by type:

  "error": {"message":"'auditable_type' should be one of 'host, parameter, architecture, puppetclass, os, hostgroup, template', but the query was 'AuthSource'","class":"ScopedSearch::QueryNotSupported"}

From audit logs the available types seem to be:

            "auditable_type": "AuthSource",
            "auditable_type": "ComputeAttribute",
            "auditable_type": "ComputeProfile",
            "auditable_type": "ComputeResource",
            "auditable_type": "Domain",
            "auditable_type": "HostClass",
            "auditable_type": "HostgroupClass",
            "auditable_type": "Katello::System",
            "auditable_type": "Location",
            "auditable_type": "LookupKey",
            "auditable_type": "LookupValue",
            "auditable_type": "Medium",
            "auditable_type": "Organization",
            "auditable_type": "Ptable",
            "auditable_type": "Role",
            "auditable_type": "Setting",
            "auditable_type": "SmartProxy",
            "auditable_type": "Subnet",
            "auditable_type": "User",
            "auditable_type": "Usergroup",

We would expect these types to be able to be queried as well as the types that already exist.


Related issues 2 (0 open2 closed)

Related to Foreman - Feature #17842: add audit search for compute resource typeClosedShlomi Zadok12/25/2016Actions
Related to Foreman - Bug #17813: audits API can't search on LookupValue typeClosedShlomi Zadok12/21/2016Actions
Actions #1

Updated by Tomáš Strachota about 7 years ago

  • Subject changed from Cannot query most auditable_types in API to Cannot query most auditable_types in API
  • Target version set to 115
Actions #2

Updated by Dominic Cleal about 7 years ago

  • Category changed from 19 to Search
  • Target version deleted (115)
Actions #3

Updated by Marek Hulán about 7 years ago

  • Related to Feature #17842: add audit search for compute resource type added
Actions #4

Updated by Marek Hulán about 7 years ago

  • Related to Bug #17813: audits API can't search on LookupValue type added
Actions #5

Updated by Marek Hulán about 7 years ago

  • Target version set to 115

I think the target version was removed by accident so resetting. The fix will be probably similar to the issues I linked.

Actions #6

Updated by Tomáš Strachota about 7 years ago

  • Status changed from New to Assigned
  • Assignee set to Tomáš Strachota
Actions #7

Updated by The Foreman Bot about 7 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/4363 added
Actions #8

Updated by Anonymous about 7 years ago

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

Updated by Marek Hulán about 7 years ago

  • translation missing: en.field_release set to 209
Actions

Also available in: Atom PDF