Skip to content

Commit

Permalink
Fixed issue #9397: List_surveys API does not return surveys that spec…
Browse files Browse the repository at this point in the history
…ified user owns
  • Loading branch information
c-schmitz committed Dec 30, 2014
1 parent 72f53da commit 16adfa3
Show file tree
Hide file tree
Showing 2 changed files with 653 additions and 676 deletions.
9 changes: 4 additions & 5 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -577,15 +577,14 @@ public function getSurveys_json()
$clang = $this->getController()->lang;
$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);

$surveys = Survey::model();
//!!! Is this even possible to execute?
$oSurvey = new Survey;
if (!Permission::model()->hasGlobalPermission('superadmin','read'))
$surveys->permission(Yii::app()->user->getId());
$oSurvey->permission(Yii::app()->user->getId());

$surveys = $surveys->with(array('languagesettings'=>array('condition'=>'surveyls_language=language'), 'owner'))->findAll();
$aSurveys = $oSurvey->with(array('languagesettings'=>array('condition'=>'surveyls_language=language'), 'owner'))->findAll();
$aSurveyEntries = new stdClass();
$aSurveyEntries->page = 1;
foreach ($surveys as $rows)
foreach ($aSurveys as $rows)
{
if (!isset($rows->owner->attributes)) $aOwner=array('users_name'=>$clang->gT('(None)')); else $aOwner=$rows->owner->attributes;
$rows = array_merge($rows->attributes, $rows->defaultlanguage->attributes, $aOwner);
Expand Down

0 comments on commit 16adfa3

Please sign in to comment.