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

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