lintel 0.2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
lintel::User Class Reference

#include <User.h>

Public Types

enum  Sex { Male , Female }
 

Public Member Functions

 User (std::string firstName, std::string lastName, Sex sex, std::string email, std::string userName, std::string password, std::vector< Group > groups, std::chrono::sys_time< std::chrono::microseconds > createdTimestamp=std::chrono::time_point_cast< std::chrono::microseconds >(std::chrono::system_clock::now()))
 
const std::string & getFirstName () const
 
const std::string & getLastName () const
 
Sex getSex () const
 
const std::string & getEmail () const
 
const std::string & getUserName () const
 
const std::string & getPassword () const
 
bool has (const Group &group) const
 
const std::chrono::sys_time< std::chrono::microseconds > & getCreatedTimestamp () const
 
const std::vector< Group > & getGroups () const
 

Friends

std::ostream & operator<< (std::ostream &os, const User &user)
 

Detailed Description

User class for controlling of access right etc.

The user class contains all important information for the user itself. Also the a collection of groups, which implies the access right for the user.

All information of the user are saved in the database and the password is of course saved as password hash.

Member Enumeration Documentation

◆ Sex

Enumerator
Male 
Female 

Constructor & Destructor Documentation

◆ User()

lintel::User::User ( std::string  firstName,
std::string  lastName,
Sex  sex,
std::string  email,
std::string  userName,
std::string  password,
std::vector< Group >  groups,
std::chrono::sys_time< std::chrono::microseconds >  createdTimestamp = std::chrono::time_point_cast< std::chrono::microseconds >(std::chrono::system_clock::now()) 
)

Constructor.

Parameters
firstNameuser's first name
lastNameuser's last name
sexuser's sex
emailuser's email address
userNamelogin username
passwordpassword (will be hashed)
groupsgroups this user belongs to
createdTimestampcreation timestamp (defaults to now)

Member Function Documentation

◆ getCreatedTimestamp()

const std::chrono::sys_time< std::chrono::microseconds > & lintel::User::getCreatedTimestamp ( ) const
Returns
creation timestamp

◆ getEmail()

const std::string & lintel::User::getEmail ( ) const
Returns
email address

◆ getFirstName()

const std::string & lintel::User::getFirstName ( ) const
Returns
first name

◆ getGroups()

const std::vector< Group > & lintel::User::getGroups ( ) const
Returns
direct groups assigned to the user

◆ getLastName()

const std::string & lintel::User::getLastName ( ) const
Returns
last name

◆ getPassword()

const std::string & lintel::User::getPassword ( ) const
Returns
password hash

◆ getSex()

Sex lintel::User::getSex ( ) const
Returns
sex

◆ getUserName()

const std::string & lintel::User::getUserName ( ) const
Returns
login username

◆ has()

bool lintel::User::has ( const Group &  group) const

Check if the user belongs to the specified group (including subgroups).

Parameters
groupgroup to check
Returns
true if the user has the group

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const User &  user 
)
friend

The documentation for this class was generated from the following file: