Password protected polls cannot be exported

This commit is contained in:
Olivier PEREZ 2016-10-06 22:42:57 +02:00
parent d980571a74
commit 73de6199fa
1 changed files with 11 additions and 4 deletions

View File

@ -18,6 +18,7 @@
*/ */
use Framadate\Services\LogService; use Framadate\Services\LogService;
use Framadate\Services\PollService; use Framadate\Services\PollService;
use Framadate\Services\SecurityService;
use Framadate\Utils; use Framadate\Utils;
include_once __DIR__ . '/app/inc/init.php'; include_once __DIR__ . '/app/inc/init.php';
@ -35,6 +36,7 @@ $poll = null;
$logService = new LogService(); $logService = new LogService();
$pollService = new PollService($connect, $logService); $pollService = new PollService($connect, $logService);
$securityService = new SecurityService();
/* PAGE */ /* PAGE */
/* ---- */ /* ---- */
@ -56,10 +58,15 @@ if (!$poll) {
exit; exit;
} }
if ($poll->hidden && empty($admin_id)) { if (empty($admin_id)) {
$smarty->assign('error', __('Error', 'Forbidden!')); $forbiddenBecauseOfPassword = !$poll->results_publicly_visible && !$securityService->canAccessPoll($poll);
$smarty->display('error.tpl'); $resultsAreHidden = $poll->hidden;
exit;
if ($resultsAreHidden || $forbiddenBecauseOfPassword) {
$smarty->assign('error', __('Error', 'Forbidden!'));
$smarty->display('error.tpl');
exit;
}
} }
$slots = $pollService->allSlotsByPoll($poll); $slots = $pollService->allSlotsByPoll($poll);