blob: c6f82a131ba1e8881cafe6f2b1ee95e30771148d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
#ifndef USERGROUP_H
#define USERGROUP_H
#include "icinga/i2-icinga.hpp"
#include "icinga/usergroup-ti.hpp"
#include "icinga/user.hpp"
namespace icinga
{
class ConfigItem;
class Notification;
/**
* An Icinga user group.
*
* @ingroup icinga
*/
class UserGroup final : public ObjectImpl<UserGroup>
{
public:
DECLARE_OBJECT(UserGroup);
DECLARE_OBJECTNAME(UserGroup);
std::set<User::Ptr> GetMembers() const;
void AddMember(const User::Ptr& user);
void RemoveMember(const User::Ptr& user);
std::set<intrusive_ptr<Notification>> GetNotifications() const;
void AddNotification(const intrusive_ptr<Notification>& notification);
void RemoveNotification(const intrusive_ptr<Notification>& notification);
bool ResolveGroupMembership(const User::Ptr& user, bool add = true, int rstack = 0);
static void EvaluateObjectRules(const User::Ptr& user);
private:
mutable std::mutex m_UserGroupMutex;
std::set<User::Ptr> m_Members;
std::set<intrusive_ptr<Notification>> m_Notifications;
static bool EvaluateObjectRule(const User::Ptr& user, const intrusive_ptr<ConfigItem>& group);
};
}
#endif /* USERGROUP_H */
|