changed: time zones -- now we have the daylight saving time different for each year (start, end) added: config option: time_zone_id (size_t) time zone identifier for not logged users or for newly created accounts those identifiers you can see in etc/time_zones.conf file or by using timezone winix function with 'a' parameter (timezone/a) (!!IMPROVE ME NOT IMPLEMENTED YET) default: 34 (Coordinated Universal Time UTC+00:00) added: config option: locale_default_id (size_t) locale for not logged users or for newly created accounts added: config option: locale_max_id (size_t) a maximum value of a locale identifier default: 100 (maximum: 1000) each locale files should have its own identifier (in "winix_locale_id" field) from zero to this value added: config option: time_zone_max_id (size_t) maximum value of a time zone identifier time zones with an id greater than this will be skipped default: 130 (maximum: 1000) removed: config option: locale_default git-svn-id: svn://ttmath.org/publicrep/winix/trunk@852 e52654a7-88a9-db11-a3e9-0013d4bc506e
109 lines
2.6 KiB
C++
Executable File
109 lines
2.6 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_user
|
|
#define headerfile_winix_core_user
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include "space/space.h"
|
|
#include "date/date.h"
|
|
|
|
|
|
#define WINIX_ACCOUNT_MAX_LOGIN_SIZE 250
|
|
#define WINIX_ACCOUNT_MAX_PASSWORD_SIZE 250
|
|
#define WINIX_ACCOUNT_MAX_EMAIL_SIZE 250
|
|
|
|
|
|
|
|
// account status
|
|
// 1 - a user has created its account -- an email was sent back to him
|
|
#define WINIX_ACCOUNT_NOT_ACTIVATED 1
|
|
|
|
// 2 - a user clicked on the link in the mail and now can normally use his account
|
|
#define WINIX_ACCOUNT_READY 2
|
|
|
|
// 3 - account was suspended
|
|
#define WINIX_ACCOUNT_SUSPENDED 3
|
|
|
|
// 4 - account was banned
|
|
#define WINIX_ACCOUNT_BLOCKED 4
|
|
|
|
|
|
/*
|
|
a user can login only to an account which status is equal to WINIX_ACCOUNT_READY
|
|
|
|
actually there is no difference between WINIX_ACCOUNT_SUSPENDED and WINIX_ACCOUNT_BANNED
|
|
only a different message will be present on the website
|
|
|
|
you can use other values of status in your plugins - this not have any impact on winix
|
|
the default 'login' winix function only allowes to login a user who has WINIX_ACCOUNT_READY value
|
|
but you can provide your own 'login' function which can work in a different way
|
|
|
|
winix knows that user is login when cur->session->puser pointer is set
|
|
(when the pointer is not null then winix do not check what the value of 'status' is --
|
|
the status is only tested in 'login' function)
|
|
*/
|
|
|
|
|
|
/*
|
|
a temporary struct used for hashing and encrypting a user's password
|
|
*/
|
|
struct UserPass
|
|
{
|
|
int pass_type; // the kind of hash (WINIX_CRYPT_HASH_* see crypt.h)
|
|
std::wstring pass; // password hashed or plain text if pass_type==0
|
|
std::string pass_encrypted; // password encrypted
|
|
bool pass_hash_salted; // true when the hash was salted (plain text passwords are never salted)
|
|
};
|
|
|
|
|
|
|
|
struct User
|
|
{
|
|
long id;
|
|
std::wstring name;
|
|
bool super_user;
|
|
std::vector<long> groups;
|
|
std::wstring email;
|
|
int notify;
|
|
|
|
|
|
// environment variables which can be set by this user
|
|
// use 'env' winix function
|
|
PT::Space env;
|
|
|
|
// environment variables set only by an administrator
|
|
// an administrator can use 'env' winix function with 'a' parameter
|
|
PT::Space aenv;
|
|
|
|
// account status
|
|
// WINIX_ACCOUNT_*
|
|
// a user can normally login only when status is WINIX_ACCOUNT_READY
|
|
int status;
|
|
|
|
// locale identifier
|
|
size_t locale_id;
|
|
|
|
// time zone identifier
|
|
size_t time_zone_id;
|
|
|
|
|
|
User();
|
|
|
|
void Clear();
|
|
bool IsMemberOf(long group);
|
|
bool ReadMonthDayTime(PT::Date & date, const wchar_t * str);
|
|
bool SetTzFromEnv();
|
|
|
|
};
|
|
|
|
|
|
#endif
|