Fixes #12644, #12643 - Correctly authorize in lookup key index
There was a problem with the authorizer for lookup key indices that led to problems with sorting and searching. Because `#includes` lazy loads the included relation, and the authorizer didn't need the relation, it didn't load the puppetclass or the lookup_value table. However, the search_for scope added an order_by or a where condition to @lookup_keys, which caused the authorizer collection to create an invalid query.
Related issues
Bug #12643: Smart variable/class param free text search throws "no such column: lookup_values.value" error
Bug #12644: Ordering smart variables list by Puppet class throws "no such column: puppetclasses.name" error
Fixes #12644, #12643 - Correctly authorize in lookup key index
There was a problem with the authorizer for lookup key indices that led
to problems with sorting and searching.
Because `#includes` lazy loads the included relation, and the authorizer
didn't need the relation, it didn't load the puppetclass or the
lookup_value table. However, the search_for scope added an order_by or a
where condition to @lookup_keys, which caused the authorizer collection
to create an invalid query.