Icinga / icingaweb2-module-director

The Director aims to be your new favourite Icinga config deployment tool. Director is designed for those who want to automate their configuration deployment and those who want to grant their “point & click” users easy access to the configuration.
https://icinga.com/docs/director/latest
GNU General Public License v2.0
413 stars 203 forks source link

fix: update filterHostGroupsQuery default argument #2809

Closed 0xliam closed 1 year ago

0xliam commented 1 year ago

Resolves #2164

Happy to work with the Icinga team on this PR - please let me know if anything needs changing.

When a role restricts users to a particular host group, e.g:

image

The following error is returned when trying to edit any host group:

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'o.object_name' in 'where clause', query was: SELECT h.id FROM icinga_hostgroup AS h WHERE (id = '324') AND (o.object_name IN ('example'))

This PR updates the filterHostGroupsQuery default argument to 'h', as per the fix outlined suggested in #2164.

I've been using this in our production environment and it doesn't appear to have caused any adverse side effects.

cla-bot[bot] commented 1 year ago

Thank you for your pull request. Before we can look at it, you'll need to sign a Contributor License Agreement (CLA).

Please follow instructions at https://icinga.com/company/contributor-agreement to sign the CLA.

After that, please reply here with a comment and we'll verify.

Contributors that have not signed yet: @0xliam

- If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Please [contact us](https://icinga.com/company/contact/) if you think this is the case. - If you signed the CLA as a corporation, your GitHub username may not have been submitted to us. Please reach out to the responsible person in your organization.
0xliam commented 1 year ago

Signed CLA

bobapple commented 1 year ago

@cla-bot check

Thomas-Gelf commented 1 year ago

Hi @0xliam, thanks for your submission! I fixed it in a slightly different place, where the method call context (directly after the related query) makes it more obvious, why that specific alias fits here.