1
0
mirror of https://gitlab.com/comunic/comunicapiv2 synced 2024-11-22 05:19:22 +00:00

Can check the availability of a virtual directory for a user

This commit is contained in:
Pierre HUBERT 2020-03-21 18:09:47 +01:00
parent 03100e0bd3
commit b45e5c4d0a
2 changed files with 17 additions and 0 deletions

View File

@ -85,6 +85,8 @@ export const Routes : Route[] = [
{path: "/settings/set_general", cb: (h) => SettingsController.SetGeneral(h)},
{path: "/settings/check_user_directory_availability", cb: (h) => SettingsController.CheckDirectoryAvailability(h)},
// Friends controller
{path: "/friends/getList", cb: (h) => FriendsController.GetList(h)},

View File

@ -88,4 +88,19 @@ export class SettingsController {
}
/**
* Check the availablity of a virtual directory for a user
*
* @param h Request handler
*/
public static async CheckDirectoryAvailability(h: RequestHandler) {
const directory = h.postVirtualDirectory("directory");
if(!await checkVirtualDirectoryAvailability(directory, h.getUserId(), VirtualDirType.USER))
h.error(401, "The specified directory is unavailable!");
h.success("The directory is available!");
}
}