2008-12-21 22:17:09 +01:00
|
|
|
/*
|
2010-02-28 01:08:10 +01:00
|
|
|
* This file is a part of Winix
|
2008-12-21 22:17:09 +01:00
|
|
|
* and is not publicly distributed
|
|
|
|
*
|
2010-02-28 22:33:06 +01:00
|
|
|
* Copyright (c) 2008-2010, Tomasz Sowa
|
2008-12-21 22:17:09 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2009-04-21 22:50:55 +02:00
|
|
|
#ifndef headerfilecmslucoreusers
|
|
|
|
#define headerfilecmslucoreusers
|
2008-12-21 22:17:09 +01:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include "user.h"
|
|
|
|
#include "ugcontainer.h"
|
2010-08-10 18:12:50 +02:00
|
|
|
#include "lastcontainer.h"
|
|
|
|
#include "request.h"
|
2010-09-18 02:51:12 +02:00
|
|
|
#include "db/db.h"
|
2008-12-30 02:05:03 +01:00
|
|
|
|
|
|
|
|
2008-12-21 22:17:09 +01:00
|
|
|
class Users
|
|
|
|
{
|
|
|
|
typedef UGContainer<User> Table;
|
|
|
|
Table table;
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
Request * request;
|
|
|
|
long how_many_logged;
|
2008-12-21 22:17:09 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
typedef Table::Iterator Iterator;
|
|
|
|
typedef Table::SizeType SizeType;
|
|
|
|
|
2010-08-10 18:12:50 +02:00
|
|
|
LastContainer last;
|
2008-12-21 22:17:09 +01:00
|
|
|
|
|
|
|
Users();
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
void SetRequest(Request * request);
|
|
|
|
|
2008-12-21 22:17:09 +01:00
|
|
|
void Clear();
|
2010-08-10 18:12:50 +02:00
|
|
|
void ReadUsers(Db * db);
|
2010-10-24 01:12:47 +02:00
|
|
|
void SetTimeZoneOffset(int offset); // !! temporarily one time_zone for all users
|
2010-02-28 01:08:10 +01:00
|
|
|
bool AddUser(const User & user);
|
|
|
|
bool IsUser(const std::string & name);
|
2008-12-21 22:17:09 +01:00
|
|
|
User * GetUser(long user_id);
|
|
|
|
User * GetUser(const std::string & name);
|
|
|
|
long GetUserId(const std::string & name);
|
|
|
|
Iterator Begin();
|
|
|
|
Iterator End();
|
|
|
|
SizeType Size();
|
|
|
|
User & operator[](SizeType pos);
|
2010-08-10 18:12:50 +02:00
|
|
|
|
|
|
|
void LoginUser(long user_id, bool remember_me);
|
|
|
|
void LogoutCurrentUser();
|
|
|
|
|
|
|
|
void IncrementLoggedUsers();
|
|
|
|
long HowManyLogged();
|
2008-12-21 22:17:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|