]> granicus.if.org Git - icinga2/blob - lib/icinga/usergroup.hpp
Service: be handled while host is down
[icinga2] / lib / icinga / usergroup.hpp
1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
2
3 #ifndef USERGROUP_H
4 #define USERGROUP_H
5
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/usergroup-ti.hpp"
8 #include "icinga/user.hpp"
9
10 namespace icinga
11 {
12
13 class ConfigItem;
14
15 /**
16  * An Icinga user group.
17  *
18  * @ingroup icinga
19  */
20 class UserGroup final : public ObjectImpl<UserGroup>
21 {
22 public:
23         DECLARE_OBJECT(UserGroup);
24         DECLARE_OBJECTNAME(UserGroup);
25
26         std::set<User::Ptr> GetMembers() const;
27         void AddMember(const User::Ptr& user);
28         void RemoveMember(const User::Ptr& user);
29
30         bool ResolveGroupMembership(const User::Ptr& user, bool add = true, int rstack = 0);
31
32         static void EvaluateObjectRules(const User::Ptr& user);
33
34 private:
35         mutable boost::mutex m_UserGroupMutex;
36         std::set<User::Ptr> m_Members;
37
38         static bool EvaluateObjectRule(const User::Ptr& user, const intrusive_ptr<ConfigItem>& group);
39 };
40
41 }
42
43 #endif /* USERGROUP_H */