/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2008-2011, Tomasz Sowa * All rights reserved. * */ #ifndef headerfile_winix_core_user #define headerfile_winix_core_user #include #include /* 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 groups; std::wstring email; int notify; // !! currently all users have the same offset // option in config: time_zone_offset int time_zone_offset; User() { Clear(); } void Clear() { id = -1; name.clear(); super_user = false; groups.clear(); email.clear(); notify = 0; time_zone_offset = 0; } bool IsMemberOf(long group) { std::vector::iterator i; for(i=groups.begin() ; i!=groups.end() ; ++i) if( *i == group ) return true; return false; } }; #endif