Bug #18690

Cannot query most auditable_types in API

Added by Tomáš Strachota 3 months ago. Updated about 1 month ago.

Status:Closed
Priority:Normal
Assigned To:Tomáš Strachota
Category:Search
Target version:Team Marek backlog
Difficulty: Bugzilla link:1426742
Found in release: Pull request:https://github.com/theforeman/foreman/pull/4363
Story points-
Velocity based estimate-
Release1.15.0Release relationshipAuto

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

Related to Foreman - Feature #17842: add audit search for compute resource type Closed 12/25/2016
Related to Foreman - Bug #17813: audits API can't search on LookupValue type Closed 12/21/2016

Associated revisions

Revision 28599ad1
Added by Tomas Strachota 3 months ago

Fixes #18690 - add missing auditable types into scoped search

History

#1 Updated by Tomáš Strachota 3 months ago

  • Subject changed from Cannot query most auditable_types in API to Cannot query most auditable_types in API
  • Target version set to Team Marek backlog

#2 Updated by Dominic Cleal 3 months ago

  • Category changed from Query interface to Search
  • Target version deleted (Team Marek backlog)

#3 Updated by Marek Hulán 3 months ago

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

#4 Updated by Marek Hulán 3 months ago

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

#5 Updated by Marek Hulán 3 months ago

  • Target version set to Team Marek backlog

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

#6 Updated by Tomáš Strachota 3 months ago

  • Status changed from New to Assigned
  • Assigned To set to Tomáš Strachota

#7 Updated by The Foreman Bot 3 months ago

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

#8 Updated by Anonymous 3 months ago

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

#9 Updated by Marek Hulán about 1 month ago

  • Release set to 1.15.0

Also available in: Atom PDF