$Author: faust $
*/
-#include <cerrno>
-#include <cassert>
-#include <algorithm>
-
#include "stg/common.h"
#include "admins_impl.h"
#include "admin_impl.h"
+#include <cerrno>
+#include <cassert>
+#include <algorithm>
+
//-----------------------------------------------------------------------------
ADMINS_IMPL::ADMINS_IMPL(STORE * st)
: ADMINS(),
- stg(0xFFFF, "@stargazer", ""),
- noAdmin(0xFFFF, "NO-ADMIN", ""),
+ stg(PRIV(0xFFFF), "@stargazer", ""),
+ noAdmin(PRIV(0xFFFF), "NO-ADMIN", ""),
data(),
store(st),
WriteServLog(GetStgLogger()),
return -1;
}
-ADMIN_IMPL adm(0, login, "");
+ADMIN_IMPL adm(PRIV(0), login, "");
admin_iter ai(find(data.begin(), data.end(), adm));
if (ai != data.end())
int ADMINS_IMPL::Del(const std::string & login, const ADMIN * admin)
{
STG_LOCKER lock(&mutex);
-ADMIN_IMPL adm(0, login, "");
const PRIV * priv = admin->GetPriv();
if (!priv->adminChg)
return -1;
}
-admin_iter ai(find(data.begin(), data.end(), adm));
+admin_iter ai(find(data.begin(), data.end(), ADMIN_IMPL(PRIV(0), login, "")));
if (ai == data.end())
{
{
if (si->second == ai)
(si->second)++;
- si++;
+ ++si;
}
data.remove(*ai);
return -1;
}
-ADMIN_IMPL adm(0, ac.login, "");
-admin_iter ai(find(data.begin(), data.end(), adm));
+admin_iter ai(find(data.begin(), data.end(), ADMIN_IMPL(PRIV(0), ac.login, "")));
if (ai == data.end())
{
for (unsigned int i = 0; i < adminsList.size(); i++)
{
- ADMIN_CONF ac(0, adminsList[i], "");
+ ADMIN_CONF ac(PRIV(0), adminsList[i], "");
if (store->RestoreAdmin(&ac, adminsList[i]))
{
return false;
}
-ADMIN_IMPL adm(0, l, "");
-admin_iter ai(find(data.begin(), data.end(), adm));
+admin_iter ai(find(data.begin(), data.end(), ADMIN_IMPL(PRIV(0), l, "")));
if (ai != data.end())
{
return true;
}
-ADMIN_IMPL adm(0, login, "");
-const_admin_iter ai(find(data.begin(), data.end(), adm));
+const_admin_iter ai(find(data.begin(), data.end(), ADMIN_IMPL(PRIV(0), login, "")));
if (ai != data.end())
return true;
return true;
}
-ADMIN_IMPL adm(0, login, "");
-admin_iter ai(find(data.begin(), data.end(), adm));
+admin_iter ai(find(data.begin(), data.end(), ADMIN_IMPL(PRIV(0), login, "")));
if (ai == data.end())
{