- Posts: 3
- Thank you received: 0
Ask the community, share ideas, and connect with other LimeSurvey users!
function hasSurveyPermission($iSurveyID,$sPermission, $sCRUD, $iUserID=null) { $oSurvey=Survey::Model()->findByPk($iSurveyID); if (!$oSurvey) return false; $iUserID=self::getUserId($iUserID); if(!$iUserID) return false; // If you own a survey you have access to the whole survey if ($iUserID==$oSurvey->owner_id) return true; // Get global correspondance for surveys rigth $sGlobalCRUD=($sCRUD=='create' || ($sCRUD=='delete' && $sPermission!='survey') ) ? 'update' : $sCRUD; return $this->hasGlobalPermission('surveys', $sGlobalCRUD, $iUserID) || $this->hasPermission($iSurveyID, 'survey', $sPermission, $sCRUD, $iUserID); }
function hasSurveyPermission($iSurveyID,$sPermission, $sCRUD, $iUserID=null) { $oSurvey=Survey::Model()->findByPk($iSurveyID); if (!$oSurvey) return false; $iUserID=self::getUserId($iUserID); if(!$iUserID) return false; // Entirely disable editing responses if($sPermission == 'responses' && ($sCRUD == 'create' || $sCRUD == 'update' || $sCRUD == 'delete')) return false; // If you own a survey you have access to the whole survey if ($iUserID==$oSurvey->owner_id) return true; // Get global correspondance for surveys rigth $sGlobalCRUD=($sCRUD=='create' || ($sCRUD=='delete' && $sPermission!='survey') ) ? 'update' : $sCRUD; return $this->hasGlobalPermission('surveys', $sGlobalCRUD, $iUserID) || $this->hasPermission($iSurveyID, 'survey', $sPermission, $sCRUD, $iUserID); }
Hi Tony ,tpartner wrote: This is a hack to entirely disable response editing. It needs to be tested and will be over-written on updates....