Files
winix/core/users.h
Tomasz Sowa ec773e5f29 added: TimeZone struct (core)
this class has information about a time zone (utf offset, daylight saving time)
       and methods for converting between UTC and local time
       structs User and Config has a TimeZone object
       System::ToLocal() and System::ToUTC() uses it for converting
       (depending whether a user is logged or not)


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@842 e52654a7-88a9-db11-a3e9-0013d4bc506e
2012-05-30 19:04:18 +00:00

79 lines
1.3 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2012, 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"
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);
};
#endif