livestatus: fix HostsTable::ContactGroupsAccessor()

refs #4372
This commit is contained in:
Michael Friedrich 2013-07-19 16:24:09 +02:00
parent 4bc4defc97
commit a939cbfef8
1 changed files with 7 additions and 1 deletions

View File

@ -1593,10 +1593,16 @@ Value HostsTable::GroupsAccessor(const Value& row)
Value HostsTable::ContactGroupsAccessor(const Value& row)
{
/* use hostcheck service */
Service::Ptr hc = static_cast<Host::Ptr>(row)->GetHostCheckService();
if (!hc)
return Empty;
/* XXX Service -> Notifications -> UserGroups */
Array::Ptr contactgroups = boost::make_shared<Array>();
BOOST_FOREACH(const Notification::Ptr& notification, static_cast<Service::Ptr>(row)->GetNotifications()) {
BOOST_FOREACH(const Notification::Ptr& notification, hc->GetNotifications()) {
ObjectLock olock(notification);
BOOST_FOREACH(const UserGroup::Ptr& ug, notification->GetGroups()) {