]> git.stg.codes - stg.git/blobdiff - projects/stargazer/admins_impl.cpp
Ticket 37. The td->tariffConf.changePolicyTimeout added in the
[stg.git] / projects / stargazer / admins_impl.cpp
index 7d73dde1834cde8481ddeee2fde6f3cc78d3de66..fb28b6e6260759ac6823afcb3575de7df283017e 100644 (file)
@@ -36,8 +36,6 @@
 #include "admins_impl.h"
 #include "admin_impl.h"
 
-using namespace std;
-
 //-----------------------------------------------------------------------------
 ADMINS_IMPL::ADMINS_IMPL(STORE * st)
     : ADMINS(),
@@ -55,14 +53,14 @@ pthread_mutex_init(&mutex, NULL);
 Read();
 }
 //-----------------------------------------------------------------------------
-int ADMINS_IMPL::Add(const string & login, const ADMIN * admin)
+int ADMINS_IMPL::Add(const std::string & login, const ADMIN * admin)
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 const PRIV * priv = admin->GetPriv();
 
 if (!priv->adminChg)
     {
-    string s = admin->GetLogStr() + " Add administrator \'" + login + "\'. Access denied.";
+    std::string s = admin->GetLogStr() + " Add administrator \'" + login + "\'. Access denied.";
     strError = "Access denied.";
     WriteServLog(s.c_str());
     return -1;
@@ -94,15 +92,15 @@ WriteServLog("%s %s", admin->GetLogStr().c_str(), strError.c_str());
 return -1;
 }
 //-----------------------------------------------------------------------------
-int ADMINS_IMPL::Del(const string & login, const ADMIN * admin)
+int ADMINS_IMPL::Del(const std::string & login, const ADMIN * admin)
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 ADMIN_IMPL adm(0, login, "");
 const PRIV * priv = admin->GetPriv();
 
 if (!priv->adminChg)
     {
-    string s = admin->GetLogStr() + " Delete administrator \'" + login + "\'. Access denied.";
+    std::string s = admin->GetLogStr() + " Delete administrator \'" + login + "\'. Access denied.";
     strError = "Access denied.";
     WriteServLog(s.c_str());
     return -1;
@@ -117,7 +115,7 @@ if (ai == data.end())
     return -1;
     }
 
-map<int, const_admin_iter>::iterator si;
+std::map<int, const_admin_iter>::iterator si;
 si = searchDescriptors.begin();
 while (si != searchDescriptors.end())
     {
@@ -141,12 +139,12 @@ return 0;
 //-----------------------------------------------------------------------------
 int ADMINS_IMPL::Change(const ADMIN_CONF & ac, const ADMIN * admin)
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 const PRIV * priv = admin->GetPriv();
 
 if (!priv->adminChg)
     {
-    string s = admin->GetLogStr() + " Change administrator \'" + ac.login + "\'. Access denied.";
+    std::string s = admin->GetLogStr() + " Change administrator \'" + ac.login + "\'. Access denied.";
     strError = "Access denied.";
     WriteServLog(s.c_str());
     return -1;
@@ -178,8 +176,8 @@ return 0;
 //-----------------------------------------------------------------------------
 int ADMINS_IMPL::Read()
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
-vector<string> adminsList;
+STG_LOCKER lock(&mutex);
+std::vector<std::string> adminsList;
 if (store->GetAdminsList(&adminsList) < 0)
     {
     WriteServLog(store->GetStrError().c_str());
@@ -201,22 +199,11 @@ for (unsigned int i = 0; i < adminsList.size(); i++)
 return 0;
 }
 //-----------------------------------------------------------------------------
-void ADMINS_IMPL::PrintAdmins() const
-{
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
-const_admin_iter ai(data.begin());
-while (ai != data.end())
-    {
-    ai->Print();
-    ai++;
-    }
-}
-//-----------------------------------------------------------------------------
-bool ADMINS_IMPL::Find(const string & l, ADMIN ** admin)
+bool ADMINS_IMPL::Find(const std::string & l, ADMIN ** admin)
 {
 assert(admin != NULL && "Pointer to admin is not null");
 
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 if (data.empty())
     {
     printfd(__FILE__, "No admin in system!\n");
@@ -236,9 +223,9 @@ if (ai != data.end())
 return true;
 }
 //-----------------------------------------------------------------------------
-bool ADMINS_IMPL::Exists(const string & login) const
+bool ADMINS_IMPL::Exists(const std::string & login) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 if (data.empty())
     {
     printfd(__FILE__, "no admin in system!\n");
@@ -254,9 +241,9 @@ if (ai != data.end())
 return false;
 }
 //-----------------------------------------------------------------------------
-bool ADMINS_IMPL::Correct(const string & login, const std::string & password, ADMIN ** admin)
+bool ADMINS_IMPL::Correct(const std::string & login, const std::string & password, ADMIN ** admin)
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 if (data.empty())
     {
     printfd(__FILE__, "no admin in system!\n");
@@ -283,7 +270,7 @@ return true;
 //-----------------------------------------------------------------------------
 int ADMINS_IMPL::OpenSearch() const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 handle++;
 searchDescriptors[handle] = data.begin();
 return handle;
@@ -291,7 +278,7 @@ return handle;
 //-----------------------------------------------------------------------------
 int ADMINS_IMPL::SearchNext(int h, ADMIN_CONF * ac) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 if (searchDescriptors.find(h) == searchDescriptors.end())
     {
     WriteServLog("ADMINS. Incorrect search handle.");
@@ -310,7 +297,7 @@ return 0;
 //-----------------------------------------------------------------------------
 int ADMINS_IMPL::CloseSearch(int h) const
 {
-STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+STG_LOCKER lock(&mutex);
 if (searchDescriptors.find(h) != searchDescriptors.end())
     {
     searchDescriptors.erase(searchDescriptors.find(h));