1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-12-27 22:18:52 +00:00

Check out whether a virtual directory can be taken by a group or not

This commit is contained in:
Pierre HUBERT 2019-12-26 13:56:28 +01:00
parent f1422651f2
commit 6be2cda9fb
2 changed files with 17 additions and 0 deletions

View File

@ -216,6 +216,21 @@ export class GroupsController {
h.success("Group settings have been successfully updated!");
}
/**
* Check the availability of a virtual directory for a given group
*
* @param h Request handler
*/
public static async CheckVirtualDirectory(h: RequestHandler) {
const groupID = await h.postGroupIDWithAccess("groupID", GroupsAccessLevel.ADMIN_ACCESS);
const virtualDirectory = h.postVirtualDirectory("directory");
if(!await checkVirtualDirectoryAvailability(virtualDirectory, groupID, VirtualDirType.GROUP))
h.error(401, "The requested virtual directory seems not to be available!");
h.success("Requested virtual directory seems to be available!");
}
/**
* Turn a GroupInfo object into a valid API object
*

View File

@ -98,4 +98,6 @@ export const Routes : Route[] = [
{path: "/groups/get_settings", cb: (h) => GroupsController.GetSettings(h)},
{path: "/groups/set_settings", cb: (h) => GroupsController.SetSettings(h)},
{path: "/groups/checkVirtualDirectory", cb: (h) => GroupsController.CheckVirtualDirectory(h)},
]