-
Notifications
You must be signed in to change notification settings - Fork 0
/
group_handler.h
31 lines (26 loc) · 966 Bytes
/
group_handler.h
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
27
28
29
30
#define SUCC 0
#define PRV_GRP 1
#define USR_EXISTS 2
#define INV_USR 3
#define INV_GRP 4
#define PER_DEN 5
#define DUP_REQ 6
#include <utility>
#include <vector>
#define DIR_NULL -1
struct group_t{
//All helper functions assume that g_id, u_id passed
//to them are valid and corresponding group and user
//exists as such.
//CAUTION: Think twice before exposing them directly
bool group_exists(const std::string&);
bool is_member(const std::string&, const std::string&, const std::string&);
bool is_admin(const std::string&, const std::string&);
void add_user(const std::string&, const std::string&);
//API
int create_group(const std::string&, const std::string&);
std::vector<std::string> list_groups();
int join_group(const std::string& , const std::string& );
int accept_request(const std::string&, const std::string &, const std::string&);
std::pair<int, std::vector<std::string>> list_requests(const std::string& , const std::string& );
};