From 95fb3c74e079a5587e9f9f0a7f2bc88ac60b8faa Mon Sep 17 00:00:00 2001 From: Pascal Corpet Date: Thu, 24 Jun 2010 22:50:50 +0200 Subject: [PATCH] Lets admin see surveys even when not in targeted promos. Closes #967 --- ChangeLog | 1 + modules/survey.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2f7957c..d060c8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,7 @@ Bug/Wish: * Survey: - #993: Enables survey for oranges -Car - #1002: Lets the user set promo interval in both ways -Car + - #967: Lets admin see surveys even when not in targeted promos -Car * XnetGrp: - #1086: Fixes view members of group even if not in group -Car diff --git a/modules/survey.php b/modules/survey.php index 15ee732..1057622 100644 --- a/modules/survey.php +++ b/modules/survey.php @@ -70,6 +70,10 @@ class SurveyModule extends PLModule return PL_DO_AUTH; } if (Post::has('survey_submit')) { // checks if the survey has already been filled in + // admins can see the survey but not vote + if (!$this->check_surveyPerms($page, $survey, false, false)) { + return PL_DO_AUTH; + } $uid = 0; if (!$survey->isMode(Survey::MODE_ALL)) { // if survey is restriced to alumni $uid = S::v('uid'); @@ -397,7 +401,7 @@ class SurveyModule extends PLModule // }}} // {{{ function check_surveyPerms() : checks the particular surveys access permissions - function check_surveyPerms(&$page, $survey, $silent = false) + function check_surveyPerms(&$page, $survey, $silent = false, $admin_allowed = true) { $this->load('survey.inc.php'); if ($survey->isMode(Survey::MODE_ALL)) { // if the survey is not reserved to alumni @@ -421,6 +425,12 @@ class SurveyModule extends PLModule if ($allowed) { return true; } + if (S::admin() && $admin_allowed) { + if (!$silent) { + $page->trigWarning('Tu as accès à ce sondage car tu es administrateur du site.'); + } + return true; + } if (!$silent) { $page->kill("Tu n'as pas accès à ce sondage car il est réservé à d'autres promotions."); } -- 2.1.4