aboutsummaryrefslogtreecommitdiff
path: root/src/User.cpp
blob: e2017ffb6e7fe33c95e2495e66ec5c2f99e452c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "../include/User.hpp"
#include "../include/Group.hpp"

namespace odhtdb
{
    User::User(const std::string &_name, Group *group) : name(_name)
    {
        if(name.size() > 255)
            throw UserNameTooLongException(name);
        
        if(group)
        {
            groups.emplace_back(group);
            group->addUser(this);
        }
    }
    
    void User::addToGroup(Group *group)
    {
        if(group)
        {
            groups.emplace_back(group);
            group->addUser(this);
        }
    }
}