return true;
}
//-----------------------------------------------------------------------------
-bool USERS_IMPL::Unauthorize(const std::string & login, const AUTH * auth)
+bool USERS_IMPL::Unauthorize(const std::string & login,
+ const AUTH * auth,
+ const std::string & reason)
{
user_iter iter;
STG_LOCKER lock(&mutex, __FILE__, __LINE__);
uint32_t ip = iter->GetCurrIP();
-iter->Unauthorize(auth);
+iter->Unauthorize(auth, reason);
if (!iter->GetAuthorized())
DelFromIPIdx(ip);
return it != ipIndex.end();
}
//-----------------------------------------------------------------------------
+bool USERS_IMPL::IsIPInUse(uint32_t ip, const std::string & login, CONST_USER_PTR * user) const
+{
+STG_LOCKER lock(&mutex, __FILE__, __LINE__);
+std::list<USER_IMPL>::const_iterator iter;
+iter = users.begin();
+while (iter != users.end())
+ {
+ if (iter->GetLogin() != login &&
+ !iter->GetProperty().ips.Get().IsAnyIP() &&
+ iter->GetProperty().ips.Get().IsIPInIPS(ip))
+ {
+ if (user != NULL)
+ *user = &(*iter);
+ return true;
+ }
+ ++iter;
+ }
+return false;
+}
+//-----------------------------------------------------------------------------
void USERS_IMPL::AddNotifierUserAdd(NOTIFIER_BASE<USER_PTR> * n)
{
STG_LOCKER lock(&mutex, __FILE__, __LINE__);