Skip to content

Commit

Permalink
Fixed issue #19169: [security] Privilege escalation to edit survey (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Oct 26, 2023
1 parent 4bb0df5 commit 35d09e5
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions application/controllers/SurveyAdministrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -813,18 +813,19 @@ public function actionChangeMultipleSurveyGroup()

foreach ($aSIDs as $iSurveyID) {
$oSurvey = Survey::model()->findByPk((int)$iSurveyID);
$oSurvey->gsid = $iSurveyGroupId;
$aResults[$iSurveyID]['title'] = $oSurvey->correct_relation_defaultlanguage->surveyls_title;
/* Permission must be checked with current SurveyGroup, SurveyGroup give Surveys Permission, see mantis issue #19169 */
if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update')) {
$aResults[$iSurveyID]['result'] = false;
$aResults[$iSurveyID]['error'] = gT("User does not have valid permissions");
continue;
}
$oSurvey->gsid = $iSurveyGroupId;
if ($oSurvey->save()) {
$aResults[$iSurveyID]['result'] = true;
} else {
if ($oSurvey->save()) {
$aResults[$iSurveyID]['result'] = true;
} else {
$aResults[$iSurveyID]['result'] = false;
$aResults[$iSurveyID]['error'] = gT("Survey update failed");
}
$aResults[$iSurveyID]['result'] = false;
$aResults[$iSurveyID]['error'] = gT("Survey update failed");
}
}

Expand Down

0 comments on commit 35d09e5

Please sign in to comment.