From 6ac32c655e66e6e70c85391cad60d3ed4db64af1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20V=C3=A1zquez=20Acosta?=
 <mvaled@users.noreply.github.com>
Date: Wed, 16 Jan 2019 06:51:43 -0500
Subject: [PATCH] [FIX] survey: don't disclose the survey via print

To avoid bigger changes, only verify if the login is required.
A proper refactoring has been implemented in master at 9771fdfe8f658fd0f

Closes odoo/odoo#30166
---
 addons/survey/controllers/main.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/addons/survey/controllers/main.py b/addons/survey/controllers/main.py
index 553fc5ad4b22..331b8a8642cc 100644
--- a/addons/survey/controllers/main.py
+++ b/addons/survey/controllers/main.py
@@ -252,6 +252,10 @@ class WebsiteSurvey(http.Controller):
     def print_survey(self, survey, token=None, **post):
         '''Display an survey in printable view; if <token> is set, it will
         grab the answers of the user_input_id that has <token>.'''
+
+        if survey.auth_required and request.env.user == request.website.user_id:
+            return request.render("survey.auth_required", {'survey': survey, 'token': token})
+
         return request.render('survey.survey_print',
                                       {'survey': survey,
                                        'token': token,
-- 
GitLab