From 1328d943c5016dd1662a4e46d4a408bca010cffc Mon Sep 17 00:00:00 2001 From: Aleksi Lindeman <0xdec05eba@gmail.com> Date: Sun, 11 Mar 2018 00:12:37 +0100 Subject: Add operation to allow users to be added to group WARNING! Lazy implementation everywhere, does not handle out-of-order packets --- include/User.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'include/User.hpp') diff --git a/include/User.hpp b/include/User.hpp index ab5872a..fb37876 100644 --- a/include/User.hpp +++ b/include/User.hpp @@ -3,9 +3,12 @@ #include "Signature.hpp" #include #include +#include namespace odhtdb { + class Group; + class UserNameTooLongException : public std::runtime_error { public: @@ -21,15 +24,15 @@ namespace odhtdb public: virtual ~User(){} + void addToGroup(Group *group); + const std::string& getName() const { return name; } + const std::vector& getGroups() const { return groups; } virtual const Signature::PublicKey& getPublicKey() const = 0; protected: - User(const std::string &_name) : name(_name) - { - if(name.size() > 255) - throw UserNameTooLongException(name); - } + User(const std::string &name, Group *group); private: std::string name; + std::vector groups; }; } -- cgit v1.2.3