Skip to content

Commit

Permalink
Dev: hardened the surveymenu settings against misuse
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Jul 19, 2017
1 parent b9fe83c commit d6ce138
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion application/models/Surveymenu.php
Expand Up @@ -300,8 +300,11 @@ public function search()
$criteria=new CDbCriteria;

//Don't show main menu when not superadmin
if(!Permission::model()->hasGlobalPermission('superadmin','read'))
if(Yii::app()->getConfig('demoMode') || !Permission::model()->hasGlobalPermission('superadmin','read'))
{
$criteria->compare('id','<> 1');
$criteria->compare('id','<> 2');
}

$criteria->compare('id',$this->id);
$criteria->compare('parent_id',$this->parent_id);
Expand Down
5 changes: 4 additions & 1 deletion application/models/SurveymenuEntries.php
Expand Up @@ -287,8 +287,11 @@ public function search()
$criteria=new CDbCriteria;

//Don't show main menu when not superadmin
if(!Permission::model()->hasGlobalPermission('superadmin','read'))
if(Yii::app()->getConfig('demoMode') || !Permission::model()->hasGlobalPermission('superadmin','read'))
{
$criteria->compare('menu_id','<> 1');
$criteria->compare('menu_id','<> 2');
}

$criteria->compare('id',$this->id);
$criteria->compare('menu_id',$this->menu_id);
Expand Down

0 comments on commit d6ce138

Please sign in to comment.