Can check the availability of a domain.

This commit is contained in:
Pierre
2018-04-17 19:16:10 +02:00
parent 37d21ee6c3
commit e22205e91e
3 changed files with 44 additions and 1 deletions

View File

@ -27,6 +27,28 @@ class SettingsComponents {
return $this->dbToGeneralSettings($entry);
}
/**
* Check whether a directory is already linked to a user or not. If yes,
* check if it linked to a specified user ID.
*
* @param string $directory The directory to check
* @param int $userID Target user ID
* @return bool TRUE if the directory is available for the current user,
* FALSE else
*/
public function checkUserDirectoryAvailability(string $directory, int $userID) : bool {
//Redirect the request to the user component
$folderUserID = components()->user->findByFolder($directory);
//Check if the folder is available
if($folderUserID == 0)
return TRUE;
//Check else if the user is owning this domain or not
return $folderUserID == $userID;
}
/**
* Get Single User Infos from database and return its information as an array
*