aboutsummaryrefslogtreecommitdiff
path: root/include/odhtdb/Group.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-03-13 06:26:06 +0100
committerdec05eba <dec05eba@protonmail.com>2020-08-18 23:25:46 +0200
commit5a8727e34b938b70623ca865273fd81c7604b461 (patch)
treea2921e90aa454072dc58fced36b508f67f5d1226 /include/odhtdb/Group.hpp
parent9ffc25c9d99fe86d4789108d1d8615ecb0388cc6 (diff)
Expose include dir
Diffstat (limited to 'include/odhtdb/Group.hpp')
-rw-r--r--include/odhtdb/Group.hpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/include/odhtdb/Group.hpp b/include/odhtdb/Group.hpp
new file mode 100644
index 0000000..315961d
--- /dev/null
+++ b/include/odhtdb/Group.hpp
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "types.hpp"
+#include "DataView.hpp"
+#include "Permission.hpp"
+#include <string>
+#include <vector>
+#include <stdexcept>
+
+namespace odhtdb
+{
+ class User;
+
+ class GroupNameTooLongException : public std::runtime_error
+ {
+ public:
+ GroupNameTooLongException(const std::string &groupName) :
+ std::runtime_error(std::string("The group name ") + groupName + " is longer than 255 bytes")
+ {
+
+ }
+ };
+
+
+
+ class Group
+ {
+ friend class User;
+ public:
+ Group(const std::string &name, uint8_t id[16], const Permission &permission);
+ ~Group();
+
+ const std::string& getName() const;
+ DataView getId() const;
+ const Permission& getPermission() const;
+ const std::vector<const User*>& getUsers() const;
+ private:
+ void addUser(const User *user);
+ private:
+ std::string name;
+ uint8_t id[16];
+ Permission permission;
+ std::vector<const User*> users;
+ };
+}