#include <cassert>
#include <algorithm>
-#include "stg/admins.h"
-#include "stg/admin.h"
#include "stg/common.h"
#include "admins_impl.h"
#include "admin_impl.h"
//-----------------------------------------------------------------------------
ADMINS_IMPL::ADMINS_IMPL(STORE * st)
- : stg(0xFFFF, "@stargazer", ""),
+ : ADMINS(),
+ stg(0xFFFF, "@stargazer", ""),
noAdmin(0xFFFF, "NO-ADMIN", ""),
data(),
store(st),
handle(0)
{
pthread_mutex_init(&mutex, NULL);
-ReadAdmins();
+Read();
}
//-----------------------------------------------------------------------------
int ADMINS_IMPL::Add(const string & login, const ADMIN * admin)
if (ai != data.end())
{
- strError = "Administrator \'" + login + "\' cannot not be added. Administrator alredy exist.";
+ strError = "Administrator \'" + login + "\' cannot not be added. Administrator already exist.";
WriteServLog("%s %s", admin->GetLogStr().c_str(), strError.c_str());
return -1;
return 0;
}
//-----------------------------------------------------------------------------
-int ADMINS_IMPL::ReadAdmins()
+int ADMINS_IMPL::Read()
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
vector<string> adminsList;
}
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::FindAdmin(const string & l, ADMIN ** admin)
+bool ADMINS_IMPL::Find(const string & l, ADMIN ** admin)
{
assert(admin != NULL && "Pointer to admin is not null");
return true;
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::AdminExists(const string & login) const
+bool ADMINS_IMPL::Exists(const string & login) const
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
if (data.empty())
return false;
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::AdminCorrect(const string & login, const std::string & password, ADMIN ** admin)
+bool ADMINS_IMPL::Correct(const string & login, const std::string & password, ADMIN ** admin)
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
if (data.empty())