85 lines
1.3 KiB
C++
Executable File
85 lines
1.3 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2008-2014, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_core_users
|
|
#define headerfile_winix_core_users
|
|
|
|
#include <map>
|
|
#include "user.h"
|
|
#include "ugcontainer.h"
|
|
#include "lastcontainer.h"
|
|
#include "cur.h"
|
|
#include "db/db.h"
|
|
|
|
|
|
namespace Winix
|
|
{
|
|
|
|
|
|
|
|
class SessionManager;
|
|
|
|
|
|
class Users
|
|
{
|
|
typedef UGContainer<User> Table;
|
|
|
|
public:
|
|
|
|
typedef Table::Iterator Iterator;
|
|
typedef Table::SizeType SizeType;
|
|
|
|
LastContainer last;
|
|
|
|
Users();
|
|
|
|
void SetCur(Cur * pcur);
|
|
void SetSessionManager(SessionManager * sm);
|
|
|
|
void Clear();
|
|
void ReadUsers(Db * db);
|
|
bool AddUser(const User & user);
|
|
bool IsUser(const std::wstring & name);
|
|
User * GetUser(long user_id);
|
|
User * GetUser(const std::wstring & name);
|
|
long GetUserId(const std::wstring & name);
|
|
Iterator Begin();
|
|
Iterator End();
|
|
SizeType Size();
|
|
bool Remove(long user_id);
|
|
|
|
bool LoginUser(long user_id, bool remember_me, bool use_ses_log = false);
|
|
size_t LogoutUser(long user_id);
|
|
void LogoutCurrentUser();
|
|
|
|
void IncrementLoggedUsers();
|
|
long HowManyLogged();
|
|
|
|
|
|
private:
|
|
|
|
Table table;
|
|
Cur * cur;
|
|
SessionManager * session_manager;
|
|
long how_many_logged;
|
|
|
|
bool LoginUserCheckSession(bool use_ses_log);
|
|
User * LoginUserCheckStatus(long user_id, bool use_ses_log);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Winix
|
|
|
|
|
|
|
|
#endif
|