Project

General

Profile

Actions

Bug #28093

closed

Wrong host ownership in UserMailNotifications

Added by Emil Dragu over 5 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Notifications
Target version:
-
Fixed in Releases:
Found in Releases:

Description

This behavior was detected as a result of incorrect hosts in host_mailer("Configuration Management Summary Report") mail notification.

Steps to reproduce.
1. Must have a usergroup and a user that is part of this group but is not administrator.
2. Set owner of a host to the above usergroup.
3. Run the following with foreman-rake console(I assume the same happens in mail notification tasks):
usr = User.find_by(login: 'testuser')
usr.hosts #correctly returns all the hosts the user owns and thus is authorized to view
Host::Managed.authorized_as(usr, :view_hosts, Host) # this should include the host owned by the groups user is part of, but is not. Scoped search seems to be executed based on current user which is foreman_console_admin in this case.

Actions

Also available in: Atom PDF