3131import org .aarboard .nextcloud .api .filesharing .ShareType ;
3232import org .aarboard .nextcloud .api .filesharing .SharesXMLAnswer ;
3333import org .aarboard .nextcloud .api .filesharing .SingleShareXMLAnswer ;
34+ import org .aarboard .nextcloud .api .groupfolders .GroupFolderInfo ;
35+ import org .aarboard .nextcloud .api .groupfolders .GroupFolders ;
3436import org .aarboard .nextcloud .api .provisioning .*;
3537import org .aarboard .nextcloud .api .utils .*;
3638import org .aarboard .nextcloud .api .webdav .Files ;
@@ -48,6 +50,7 @@ public class NextcloudConnector implements AutoCloseable {
4850 private final ConfigConnector cc ;
4951 private final Folders fd ;
5052 private final Files fl ;
53+ private final GroupFolders gf ;
5154
5255 /**
5356 *
@@ -110,6 +113,7 @@ public NextcloudConnector(String originalServiceUrl, AuthenticationConfig authen
110113 cc = new ConfigConnector (this .serverConfig );
111114 fd = new Folders (this .serverConfig );
112115 fl = new Files (this .serverConfig );
116+ gf = new GroupFolders (this .serverConfig );
113117
114118 } catch (MalformedURLException e ) {
115119 throw new IllegalArgumentException (e );
@@ -131,6 +135,7 @@ public NextcloudConnector(String serverName, boolean useHTTPS, int port,
131135 cc = new ConfigConnector (this .serverConfig );
132136 fd = new Folders (this .serverConfig );
133137 fl = new Files (this .serverConfig );
138+ gf = new GroupFolders (this .serverConfig );
134139 }
135140
136141 /**
@@ -189,6 +194,84 @@ public void shutdown() throws IOException {
189194 ConnectorCommon .shutdown ();
190195 }
191196
197+ /**
198+ * Creates a new group folder (Group Folders app must be installed).
199+ *
200+ * @param mountPoint name/mount point of the group folder
201+ * @return the id of the newly created group folder
202+ */
203+ public int createGroupFolder (String mountPoint ) {
204+ return gf .createGroupFolder (mountPoint );
205+ }
206+
207+ /**
208+ * Renames (changes the mount point of) a group folder.
209+ *
210+ * @param groupFolderId id of the group folder
211+ * @param newMountPoint new name/mount point
212+ */
213+ public void renameGroupFolder (int groupFolderId , String newMountPoint ) {
214+ gf .renameGroupFolder (groupFolderId , newMountPoint );
215+ }
216+
217+ /**
218+ * Deletes a group folder.
219+ *
220+ * @param groupFolderId id of the group folder
221+ */
222+ public void deleteGroupFolder (int groupFolderId ) {
223+ gf .deleteGroupFolder (groupFolderId );
224+ }
225+
226+ /**
227+ * @return all group folders visible to the current user
228+ */
229+ public Collection <GroupFolderInfo > getGroupFolders () {
230+ return gf .getGroupFolders ();
231+ }
232+
233+ /**
234+ * Grants a group access to a group folder.
235+ *
236+ * @param groupFolderId id of the group folder
237+ * @param group group id to grant access to
238+ */
239+ public void grantAccessToGroupFolder (int groupFolderId , String group ) {
240+ gf .grantAccess (groupFolderId , group );
241+ }
242+
243+ /**
244+ * Revokes a group's access to a group folder.
245+ *
246+ * @param groupFolderId id of the group folder
247+ * @param group group id to revoke access from
248+ */
249+ public void revokeAccessToGroupFolder (int groupFolderId , String group ) {
250+ gf .revokeAccess (groupFolderId , group );
251+ }
252+
253+ /**
254+ * Sets the permissions a group has on a group folder.
255+ *
256+ * @param groupFolderId id of the group folder
257+ * @param group group id
258+ * @param permissions permission bit mask (1 = read, 2 = update, 4 =
259+ * create, 8 = delete, 16 = share, 31 = all)
260+ */
261+ public void setGroupFolderPermissions (int groupFolderId , String group , int permissions ) {
262+ gf .setGroupPermissions (groupFolderId , group , permissions );
263+ }
264+
265+ /**
266+ * Sets the quota of a group folder.
267+ *
268+ * @param groupFolderId id of the group folder
269+ * @param quota quota in bytes, or {@code -3} for an unlimited quota
270+ */
271+ public void setGroupFolderQuota (int groupFolderId , long quota ) {
272+ gf .setQuota (groupFolderId , quota );
273+ }
274+
192275 /**
193276 * Close the HTTP client. Perform this to cleanly shut down this
194277 * application.
0 commit comments