git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Many changes related to getting user information via sgconf.
[stg.git]
/
projects
/
stargazer
/
admins_impl.cpp
diff --git
a/projects/stargazer/admins_impl.cpp
b/projects/stargazer/admins_impl.cpp
index 0179910ea12bdac511baaa23387df8ac24995156..7d73dde1834cde8481ddeee2fde6f3cc78d3de66 100644
(file)
--- a/
projects/stargazer/admins_impl.cpp
+++ b/
projects/stargazer/admins_impl.cpp
@@
-32,8
+32,6
@@
#include <cassert>
#include <algorithm>
#include <cassert>
#include <algorithm>
-#include "stg/admins.h"
-#include "stg/admin.h"
#include "stg/common.h"
#include "admins_impl.h"
#include "admin_impl.h"
#include "stg/common.h"
#include "admins_impl.h"
#include "admin_impl.h"
@@
-42,16
+40,19
@@
using namespace std;
//-----------------------------------------------------------------------------
ADMINS_IMPL::ADMINS_IMPL(STORE * st)
//-----------------------------------------------------------------------------
ADMINS_IMPL::ADMINS_IMPL(STORE * st)
- : stg(0xFFFF, "@stargazer", ""),
+ : ADMINS(),
+ stg(0xFFFF, "@stargazer", ""),
noAdmin(0xFFFF, "NO-ADMIN", ""),
data(),
store(st),
WriteServLog(GetStgLogger()),
searchDescriptors(),
noAdmin(0xFFFF, "NO-ADMIN", ""),
data(),
store(st),
WriteServLog(GetStgLogger()),
searchDescriptors(),
- handle(0)
+ handle(0),
+ mutex(),
+ strError()
{
pthread_mutex_init(&mutex, NULL);
{
pthread_mutex_init(&mutex, NULL);
-Read
Admins
();
+Read();
}
//-----------------------------------------------------------------------------
int ADMINS_IMPL::Add(const string & login, const ADMIN * admin)
}
//-----------------------------------------------------------------------------
int ADMINS_IMPL::Add(const string & login, const ADMIN * admin)
@@
-72,7
+73,7
@@
admin_iter ai(find(data.begin(), data.end(), adm));
if (ai != data.end())
{
if (ai != data.end())
{
- strError = "Administrator \'" + login + "\' cannot not be added. Administrator alredy exist.";
+ strError = "Administrator \'" + login + "\' cannot not be added. Administrator alre
a
dy exist.";
WriteServLog("%s %s", admin->GetLogStr().c_str(), strError.c_str());
return -1;
WriteServLog("%s %s", admin->GetLogStr().c_str(), strError.c_str());
return -1;
@@
-175,7
+176,7
@@
WriteServLog("%s Administrator \'%s\' changed.",
return 0;
}
//-----------------------------------------------------------------------------
return 0;
}
//-----------------------------------------------------------------------------
-int ADMINS_IMPL::Read
Admins
()
+int ADMINS_IMPL::Read()
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
vector<string> adminsList;
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
vector<string> adminsList;
@@
-211,14
+212,14
@@
while (ai != data.end())
}
}
//-----------------------------------------------------------------------------
}
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::Find
Admin
(const string & l, ADMIN ** admin)
+bool ADMINS_IMPL::Find(const string & l, ADMIN ** admin)
{
assert(admin != NULL && "Pointer to admin is not null");
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
if (data.empty())
{
{
assert(admin != NULL && "Pointer to admin is not null");
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
if (data.empty())
{
- printfd(__FILE__, "
n
o admin in system!\n");
+ printfd(__FILE__, "
N
o admin in system!\n");
*admin = &noAdmin;
return false;
}
*admin = &noAdmin;
return false;
}
@@
-235,7
+236,7
@@
if (ai != data.end())
return true;
}
//-----------------------------------------------------------------------------
return true;
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::
Admin
Exists(const string & login) const
+bool ADMINS_IMPL::Exists(const string & login) const
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
if (data.empty())
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
if (data.empty())
@@
-253,7
+254,7
@@
if (ai != data.end())
return false;
}
//-----------------------------------------------------------------------------
return false;
}
//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::
Admin
Correct(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())
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
if (data.empty())