]> granicus.if.org Git - icinga2/commitdiff
Add ApiUser::GetByClientCN()
authorMichael Friedrich <michael.friedrich@netways.de>
Thu, 9 Jul 2015 13:25:51 +0000 (15:25 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Thu, 9 Jul 2015 13:25:51 +0000 (15:25 +0200)
refs #9471
refs #9086

lib/remote/apiuser.cpp
lib/remote/apiuser.hpp
lib/remote/apiuser.ti

index a9c2957c876e91cc02f7ca36347cfb3ce5474c86..7427100121cd5425366b10895e60cec4071f5f1c 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "remote/apiuser.hpp"
 #include "remote/apiuser.tcpp"
+#include "base/dynamictype.hpp"
 
 using namespace icinga;
 
@@ -38,3 +39,13 @@ bool ApiUser::CheckPassword(const String& password) const
 {
        return password == GetPasswordRaw();
 }
+
+ApiUser::Ptr ApiUser::GetByClientCN(const String& cn)
+{
+       BOOST_FOREACH(const ApiUser::Ptr& user, DynamicType::GetObjectsByType<ApiUser>()) {
+               if (user->GetClientCN() == cn)
+                       return user;
+       }
+
+       return ApiUser::Ptr();
+}
index 41f8a3a0c63c57c889fad1ae5d3aa41fedc865cc..2fa2dd6c2b62ddfb52e8256e73624cefd213315c 100644 (file)
@@ -38,6 +38,8 @@ public:
        String GetPassword(void) const;
        void SetPassword(const String& password);
        bool CheckPassword(const String& password) const;
+
+       static ApiUser::Ptr GetByClientCN(const String& cn);
 };
 
 }
index 05471ad29d3020cc5e31315a96c1d8574cf0e7ad..b7180f5e166fbbb7f6eb9a7e1f143eea76ed0679 100644 (file)
@@ -25,7 +25,7 @@ namespace icinga
 class ApiUser : DynamicObject
 {
        [config, protected] String password (PasswordRaw);
-       [config] String client_cn;
+       [config] String client_cn (ClientCN);
 };
 
 }