mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
parent
c10da708ff
commit
4cb3d5b1f0
@ -41,6 +41,8 @@ void Host::OnConfigLoaded(void)
|
|||||||
Array::Ptr groups = GetGroups();
|
Array::Ptr groups = GetGroups();
|
||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
|
groups = groups->ShallowClone();
|
||||||
|
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
BOOST_FOREACH(const String& name, groups) {
|
BOOST_FOREACH(const String& name, groups) {
|
||||||
|
@ -66,9 +66,6 @@ bool HostGroup::EvaluateObjectRuleOne(const Host::Ptr& host, const ObjectRule& r
|
|||||||
/* assign host group membership */
|
/* assign host group membership */
|
||||||
group->ResolveGroupMembership(host, true);
|
group->ResolveGroupMembership(host, true);
|
||||||
|
|
||||||
/* update groups attribute for apply */
|
|
||||||
host->AddGroup(group_name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +97,8 @@ std::set<Host::Ptr> HostGroup::GetMembers(void) const
|
|||||||
|
|
||||||
void HostGroup::AddMember(const Host::Ptr& host)
|
void HostGroup::AddMember(const Host::Ptr& host)
|
||||||
{
|
{
|
||||||
|
host->AddGroup(GetName());
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
boost::mutex::scoped_lock lock(m_HostGroupMutex);
|
||||||
m_Members.insert(host);
|
m_Members.insert(host);
|
||||||
}
|
}
|
||||||
|
@ -42,6 +42,8 @@ void Service::OnConfigLoaded(void)
|
|||||||
Array::Ptr groups = GetGroups();
|
Array::Ptr groups = GetGroups();
|
||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
|
groups = groups->ShallowClone();
|
||||||
|
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
BOOST_FOREACH(const String& name, groups) {
|
BOOST_FOREACH(const String& name, groups) {
|
||||||
|
@ -69,9 +69,6 @@ bool ServiceGroup::EvaluateObjectRuleOne(const Service::Ptr& service, const Obje
|
|||||||
/* assign service group membership */
|
/* assign service group membership */
|
||||||
group->ResolveGroupMembership(service, true);
|
group->ResolveGroupMembership(service, true);
|
||||||
|
|
||||||
/* update groups attribute for apply */
|
|
||||||
service->AddGroup(group_name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,6 +100,8 @@ std::set<Service::Ptr> ServiceGroup::GetMembers(void) const
|
|||||||
|
|
||||||
void ServiceGroup::AddMember(const Service::Ptr& service)
|
void ServiceGroup::AddMember(const Service::Ptr& service)
|
||||||
{
|
{
|
||||||
|
service->AddGroup(GetName());
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
boost::mutex::scoped_lock lock(m_ServiceGroupMutex);
|
||||||
m_Members.insert(service);
|
m_Members.insert(service);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ void User::OnConfigLoaded(void)
|
|||||||
Array::Ptr groups = GetGroups();
|
Array::Ptr groups = GetGroups();
|
||||||
|
|
||||||
if (groups) {
|
if (groups) {
|
||||||
|
groups = groups->ShallowClone();
|
||||||
|
|
||||||
ObjectLock olock(groups);
|
ObjectLock olock(groups);
|
||||||
|
|
||||||
BOOST_FOREACH(const String& name, groups) {
|
BOOST_FOREACH(const String& name, groups) {
|
||||||
|
@ -66,9 +66,6 @@ bool UserGroup::EvaluateObjectRuleOne(const User::Ptr& user, const ObjectRule& r
|
|||||||
/* assign user group membership */
|
/* assign user group membership */
|
||||||
group->ResolveGroupMembership(user, true);
|
group->ResolveGroupMembership(user, true);
|
||||||
|
|
||||||
/* update groups attribute for apply */
|
|
||||||
user->AddGroup(group_name);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,6 +97,8 @@ std::set<User::Ptr> UserGroup::GetMembers(void) const
|
|||||||
|
|
||||||
void UserGroup::AddMember(const User::Ptr& user)
|
void UserGroup::AddMember(const User::Ptr& user)
|
||||||
{
|
{
|
||||||
|
user->AddGroup(GetName());
|
||||||
|
|
||||||
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
boost::mutex::scoped_lock lock(m_UserGroupMutex);
|
||||||
m_Members.insert(user);
|
m_Members.insert(user);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user