aboutsummaryrefslogtreecommitdiff
path: root/include/User.hpp
diff options
context:
space:
mode:
authorAleksi Lindeman <0xdec05eba@gmail.com>2018-03-11 00:12:37 +0100
committerAleksi Lindeman <0xdec05eba@gmail.com>2018-03-11 00:13:38 +0100
commit1328d943c5016dd1662a4e46d4a408bca010cffc (patch)
tree8483ee99e3831fca474a2b7b3743e8dbd0e6ee52 /include/User.hpp
parent230e61091b401b8b2bb9496d557a15660fb5072b (diff)
Add operation to allow users to be added to group
WARNING! Lazy implementation everywhere, does not handle out-of-order packets
Diffstat (limited to 'include/User.hpp')
-rw-r--r--include/User.hpp13
1 files changed, 8 insertions, 5 deletions
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 <string>
#include <stdexcept>
+#include <vector>
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<Group*>& 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<Group*> groups;
};
}