Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications: use initiator's tenant when subject lacks tenant relationship #13081

Merged
merged 1 commit into from
Dec 9, 2016

Conversation

isimluk
Copy link
Member

@isimluk isimluk commented Dec 9, 2016

https://bugzilla.redhat.com/show_bug.cgi?id=1400246

Automate users may pass in a $subject that lacks tenant relationship. In that case we should use initiators' tenant to determine audience of given notification.

Note: We still need to amend automate code to pass in automate user as initiator.

/cc @tinaafitz

@miq-bot add_label core, enhancement, euwe/yes
@miq-bot assign @gtanzillo

@tinaafitz
Copy link
Member

@isimluk Looks good. Automate passes in the user as the initiator.

if subject.respond_to? :tenant
subject.tenant
elsif initiator.kind_of? User
initiator.current_group.try(:tenant)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isimluk I think you can just call current_tenant on the user instance here because it's delegated to the MiqGroup class in the User class.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

done.

@miq-bot
Copy link
Member

miq-bot commented Dec 9, 2016

Checked commit isimluk@ac7a08e with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
2 files checked, 0 offenses detected
Everything looks good. 🍪

@gtanzillo gtanzillo added this to the Sprint 51 Ending Jan 2, 2017 milestone Dec 9, 2016
@gtanzillo gtanzillo merged commit 6f6b526 into ManageIQ:master Dec 9, 2016
simaishi pushed a commit that referenced this pull request Jan 9, 2017
Notifications: use initiator's tenant when subject lacks tenant relationship
(cherry picked from commit 6f6b526)

https://bugzilla.redhat.com/show_bug.cgi?id=1411511
@simaishi
Copy link
Contributor

simaishi commented Jan 9, 2017

Euwe backport details:

$ git log -1
commit ab70868bc73d23e8b64c7ed63cfa3c1948fb82f9
Author: Gregg Tanzillo <gtanzill@redhat.com>
Date:   Fri Dec 9 10:33:06 2016 -0500

    Merge pull request #13081 from isimluk/rhbz#1400246
    
    Notifications: use initiator's tenant when subject lacks tenant relationship
    (cherry picked from commit 6f6b52676964eacb45f3102813b05607d9894d9a)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1411511

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants