git.stg.codes
/
stg.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Version bump
[stg.git]
/
projects
/
stargazer
/
tariffs_impl.cpp
diff --git
a/projects/stargazer/tariffs_impl.cpp
b/projects/stargazer/tariffs_impl.cpp
index 2caf17aa77c618082c57dbcf6da19a20ac73a74b..61e3e12c88ac5a69e3c9c2e81b617838f339f2f3 100644
(file)
--- a/
projects/stargazer/tariffs_impl.cpp
+++ b/
projects/stargazer/tariffs_impl.cpp
@@
-32,16
+32,16
@@
#include <algorithm>
#include <vector>
#include <algorithm>
#include <vector>
+#include "stg/locker.h"
+#include "stg/logger.h"
+#include "stg/store.h"
+#include "stg/admin.h"
#include "tariffs_impl.h"
#include "tariffs_impl.h"
-#include "stg_locker.h"
-#include "stg_logger.h"
-#include "base_store.h"
-#include "admin.h"
using namespace std;
//-----------------------------------------------------------------------------
using namespace std;
//-----------------------------------------------------------------------------
-TARIFFS_IMPL::TARIFFS_IMPL(
BASE_
STORE * st)
+TARIFFS_IMPL::TARIFFS_IMPL(STORE * st)
: tariffs(),
store(st),
WriteServLog(GetStgLogger()),
: tariffs(),
store(st),
WriteServLog(GetStgLogger()),
@@
-106,13
+106,13
@@
if (ti != tariffs.end())
return NULL;
}
//-----------------------------------------------------------------------------
return NULL;
}
//-----------------------------------------------------------------------------
-int TARIFFS_IMPL::Chg(const TARIFF_DATA & td, const ADMIN
&
admin)
+int TARIFFS_IMPL::Chg(const TARIFF_DATA & td, const ADMIN
*
admin)
{
{
-const PRIV * priv = admin
.
GetPriv();
+const PRIV * priv = admin
->
GetPriv();
if (!priv->tariffChg)
{
if (!priv->tariffChg)
{
- string s = admin
.
GetLogStr() + " Change tariff \'"
+ string s = admin
->
GetLogStr() + " Change tariff \'"
+ td.tariffConf.name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
+ td.tariffConf.name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
@@
-127,7
+127,7
@@
ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(td.tariffConf.name));
if (ti == tariffs.end())
{
strError = "Tariff \'" + td.tariffConf.name + "\' cannot be changed. Tariff does not exist.";
if (ti == tariffs.end())
{
strError = "Tariff \'" + td.tariffConf.name + "\' cannot be changed. Tariff does not exist.";
- WriteServLog("%s %s", admin
.
GetLogStr().c_str(), strError.c_str());
+ WriteServLog("%s %s", admin
->
GetLogStr().c_str(), strError.c_str());
return -1;
}
return -1;
}
@@
-141,18
+141,18
@@
if (store->SaveTariff(td, td.tariffConf.name))
}
WriteServLog("%s Tariff \'%s\' changed.",
}
WriteServLog("%s Tariff \'%s\' changed.",
- admin
.
GetLogStr().c_str(), td.tariffConf.name.c_str());
+ admin
->
GetLogStr().c_str(), td.tariffConf.name.c_str());
return 0;
}
//-----------------------------------------------------------------------------
return 0;
}
//-----------------------------------------------------------------------------
-int TARIFFS_IMPL::Del(const string & name, const ADMIN
&
admin)
+int TARIFFS_IMPL::Del(const string & name, const ADMIN
*
admin)
{
{
-const PRIV * priv = admin
.
GetPriv();
+const PRIV * priv = admin
->
GetPriv();
if (!priv->tariffChg)
{
if (!priv->tariffChg)
{
- string s = admin
.
GetLogStr() + " Delete tariff \'"
+ string s = admin
->
GetLogStr() + " Delete tariff \'"
+ name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
+ name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
@@
-167,7
+167,7
@@
ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name));
if (ti == tariffs.end())
{
strError = "Tariff \'" + name + "\' cannot be deleted. Tariff does not exist.";
if (ti == tariffs.end())
{
strError = "Tariff \'" + name + "\' cannot be deleted. Tariff does not exist.";
- WriteServLog("%s %s", admin
.
GetLogStr().c_str(), strError.c_str());
+ WriteServLog("%s %s", admin
->
GetLogStr().c_str(), strError.c_str());
return -1;
}
return -1;
}
@@
-181,18
+181,18
@@
if (store->DelTariff(name))
tariffs.erase(ti);
WriteServLog("%s Tariff \'%s\' deleted.",
tariffs.erase(ti);
WriteServLog("%s Tariff \'%s\' deleted.",
- admin
.
GetLogStr().c_str(),
+ admin
->
GetLogStr().c_str(),
name.c_str());
return 0;
}
//-----------------------------------------------------------------------------
name.c_str());
return 0;
}
//-----------------------------------------------------------------------------
-int TARIFFS_IMPL::Add(const string & name, const ADMIN
&
admin)
+int TARIFFS_IMPL::Add(const string & name, const ADMIN
*
admin)
{
{
-const PRIV * priv = admin
.
GetPriv();
+const PRIV * priv = admin
->
GetPriv();
if (!priv->tariffChg)
{
if (!priv->tariffChg)
{
- string s = admin
.
GetLogStr() + " Add tariff \'"
+ string s = admin
->
GetLogStr() + " Add tariff \'"
+ name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
+ name + "\'. Access denied.";
strError = "Access denied.";
WriteServLog(s.c_str());
@@
-207,7
+207,7
@@
ti = find(tariffs.begin(), tariffs.end(), TARIFF_IMPL(name));
if (ti != tariffs.end())
{
strError = "Tariff \'" + name + "\' cannot be added. Tariff alredy exist.";
if (ti != tariffs.end())
{
strError = "Tariff \'" + name + "\' cannot be added. Tariff alredy exist.";
- WriteServLog("%s %s", admin
.
GetLogStr().c_str(), strError.c_str());
+ WriteServLog("%s %s", admin
->
GetLogStr().c_str(), strError.c_str());
return -1;
}
return -1;
}
@@
-221,7
+221,7
@@
if (store->AddTariff(name) < 0)
}
WriteServLog("%s Tariff \'%s\' added.",
}
WriteServLog("%s Tariff \'%s\' added.",
- admin
.
GetLogStr().c_str(), name.c_str());
+ admin
->
GetLogStr().c_str(), name.c_str());
return 0;
}
return 0;
}