Add ApiUser::GetByClientCN()

refs #9471
refs #9086
This commit is contained in:
Michael Friedrich 2015-07-09 15:25:51 +02:00
parent 58a3cd7fef
commit f8f86d89a4
3 changed files with 14 additions and 1 deletions

View 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();
}

View 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);
};
}

View File

@ -25,7 +25,7 @@ namespace icinga
class ApiUser : DynamicObject
{
[config, protected] String password (PasswordRaw);
[config] String client_cn;
[config] String client_cn (ClientCN);
};
}