/** * Check if the client is authorized to download the file * * @param File $file */ protected function checkFileAuthorizations($file) { if (!$file->isOwner($this->getUser())) { if (!$file->isAvailable()) { halt(HTTP_FORBIDDEN, __('File is not available for download')); } else { if (!empty($file->password) && !$file->checkPassword($_POST['password'])) { flash('error', __('Incorrect password')); redirect('/' . $file->getHash()); } } } }