From b5e4e52272d48d4eeda10cc36c96422c8698a057 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 14 Jul 2018 11:42:54 +0200 Subject: [PATCH] Can check through the API the validity of a domain. --- RestControllers/GroupsController.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/RestControllers/GroupsController.php b/RestControllers/GroupsController.php index 6283d44..26095a3 100644 --- a/RestControllers/GroupsController.php +++ b/RestControllers/GroupsController.php @@ -187,6 +187,27 @@ class GroupsController { return array("success" => "Group settings have been successfully updated!"); } + /** + * Check the availability of a virtual directory + * + * @url POST /groups/checkVirtualDirectory + */ + public function checkVirtualDirectory() : array { + + //Get the ID of the group to check + $groupID = getPostGroupIdWithAccess("groupID", GroupMember::ADMINISTRATOR); + + //Get post virtual directory + $virtualDirectory = getPostVirtualDirectory("directory"); + + //Check virtual directory availability + if(!checkVirtualDirectoryAvailability($virtualDirectory, $groupID, TRUE)) + Rest_fatal_error(401, "The virtual directory seems not to be available!"); + + //The directory is available + return array("success" => "The directory is available!"); + } + /** * Change (update) the logo of the group *