1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 #ifndef GROUP_MGR_H
4 #define GROUP_MGR_H
5 
6 /* #define MAX_GROUP_MEMBERS	16 */
7 
8 typedef struct _SeafileSession SeafileSession;
9 typedef struct _CcnetGroupManager CcnetGroupManager;
10 typedef struct _CcnetGroupManagerPriv CcnetGroupManagerPriv;
11 
12 struct _CcnetGroupManager
13 {
14     SeafileSession *session;
15 
16     CcnetGroupManagerPriv	*priv;
17 };
18 
19 CcnetGroupManager* ccnet_group_manager_new (SeafileSession *session);
20 
21 int
22 ccnet_group_manager_prepare (CcnetGroupManager *manager);
23 
24 void ccnet_group_manager_start (CcnetGroupManager *manager);
25 
26 int ccnet_group_manager_create_group (CcnetGroupManager *mgr,
27                                       const char *group_name,
28                                       const char *user_name,
29                                       int parent_group_id,
30                                       GError **error);
31 
32 int ccnet_group_manager_create_org_group (CcnetGroupManager *mgr,
33                                           int org_id,
34                                           const char *group_name,
35                                           const char *user_name,
36                                           int parent_group_id,
37                                           GError **error);
38 
39 int ccnet_group_manager_remove_group (CcnetGroupManager *mgr,
40                                       int group_id,
41                                       gboolean remove_anyway,
42                                       GError **error);
43 
44 int ccnet_group_manager_add_member (CcnetGroupManager *mgr,
45                                     int group_id,
46                                     const char *user_name,
47                                     const char *member_name,
48                                     GError **error);
49 
50 int ccnet_group_manager_remove_member (CcnetGroupManager *mgr,
51                                        int group_id,
52                                        const char *user_name,
53                                        const char *member_name,
54                                        GError **error);
55 
56 int ccnet_group_manager_set_admin (CcnetGroupManager *mgr,
57                                    int group_id,
58                                    const char *member_name,
59                                    GError **error);
60 
61 int ccnet_group_manager_unset_admin (CcnetGroupManager *mgr,
62                                      int group_id,
63                                      const char *member_name,
64                                      GError **error);
65 
66 int ccnet_group_manager_set_group_name (CcnetGroupManager *mgr,
67                                         int group_id,
68                                         const char *group_name,
69                                         GError **error);
70 
71 int ccnet_group_manager_quit_group (CcnetGroupManager *mgr,
72                                     int group_id,
73                                     const char *user_name,
74                                     GError **error);
75 
76 GList *
77 ccnet_group_manager_get_groups_by_user (CcnetGroupManager *mgr,
78                                         const char *user_name,
79                                         gboolean return_ancestors,
80                                         GError **error);
81 
82 CcnetGroup *
83 ccnet_group_manager_get_group (CcnetGroupManager *mgr, int group_id,
84                                GError **error);
85 
86 GList *
87 ccnet_group_manager_get_group_members (CcnetGroupManager *mgr,
88                                        int group_id,
89                                        int start,
90                                        int limit,
91                                        GError **error);
92 
93 GList *
94 ccnet_group_manager_get_members_with_prefix (CcnetGroupManager *mgr,
95                                              int group_id,
96                                              const char *prefix,
97                                              GError **error);
98 
99 int
100 ccnet_group_manager_check_group_staff (CcnetGroupManager *mgr,
101                                        int group_id,
102                                        const char *user_name,
103                                        int in_structure);
104 
105 int
106 ccnet_group_manager_remove_group_user (CcnetGroupManager *mgr,
107                                        const char *user);
108 
109 int
110 ccnet_group_manager_is_group_user (CcnetGroupManager *mgr,
111                                    int group_id,
112                                    const char *user,
113                                    gboolean in_structure);
114 
115 GList*
116 ccnet_group_manager_list_all_departments (CcnetGroupManager *mgr,
117                                           GError **error);
118 
119 GList*
120 ccnet_group_manager_get_all_groups (CcnetGroupManager *mgr,
121                                     int start, int limit, GError **error);
122 
123 int
124 ccnet_group_manager_set_group_creator (CcnetGroupManager *mgr,
125                                        int group_id,
126                                        const char *user_name);
127 
128 GList*
129 ccnet_group_manager_search_groups (CcnetGroupManager *mgr,
130                                    const char *keyword,
131                                    int start, int limit);
132 
133 GList *
134 ccnet_group_manager_get_top_groups (CcnetGroupManager *mgr, gboolean including_org, GError **error);
135 
136 GList *
137 ccnet_group_manager_get_child_groups (CcnetGroupManager *mgr, int group_id,
138                                       GError **error);
139 
140 GList *
141 ccnet_group_manager_get_descendants_groups (CcnetGroupManager *mgr, int group_id,
142                                             GError **error);
143 
144 GList *
145 ccnet_group_manager_get_ancestor_groups (CcnetGroupManager *mgr, int group_id);
146 
147 GList *
148 ccnet_group_manager_get_groups_members (CcnetGroupManager *mgr, const char *group_ids,
149                                         GError **error);
150 
151 int
152 ccnet_group_manager_update_group_user (CcnetGroupManager *mgr,
153                                        const char *old_email,
154                                        const char *new_email);
155 #endif /* GROUP_MGR_H */
156 
157