- Posts: 3
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Prevent admin edit of responses
- ChristianSpartacus
- Topic Author
- Offline
- New Member
Less
More
8 years 9 months ago #122734
by ChristianSpartacus
Prevent admin edit of responses was created by ChristianSpartacus
I need to be able to configure an anonymous token-based closed survey so that the admin does not have the ability to edit responses through the admin UI.
Any other tips to help respondents be reasonably assured that there is not an easy way for someone to change their answers are welcome.
Thank you in advance!
-Christian
Any other tips to help respondents be reasonably assured that there is not an easy way for someone to change their answers are welcome.
Thank you in advance!
-Christian
The topic has been locked.
- gabrieljenik
- Offline
- Official LimeSurvey Partner
Less
More
- Posts: 272
- Thank you received: 45
8 years 9 months ago #122736
by gabrieljenik
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
Replied by gabrieljenik on topic Prevent admin edit of responses
Why not keeping the superadmin user for your own and giving the admin a user with limited permissions?
If not, you can always edit the source code to disable the editing.
If not, you can always edit the source code to disable the editing.
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Checkout our Reporting Solutions and our plugin shop at www.encuesta.biz .
The topic has been locked.
- ChristianSpartacus
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 9 months ago #122737
by ChristianSpartacus
Replied by ChristianSpartacus on topic Prevent admin edit of responses
Thank you!
Do you happen to know which source code file I would edit to prevent even the superadmin from having access to edit responses?
Do you happen to know which source code file I would edit to prevent even the superadmin from having access to edit responses?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
8 years 9 months ago #122738
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic Prevent admin edit of responses
This is a hack to entirely disable response editing. It needs to be tested and will be over-written on updates.
In /application/models/Permission.php, find this function:
And replace it with this:
In /application/models/Permission.php, find this function:
Code:
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); }
Code:
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); }
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
- ChristianSpartacus
- Topic Author
- Offline
- New Member
Less
More
- Posts: 3
- Thank you received: 0
8 years 9 months ago #122739
by ChristianSpartacus
Replied by ChristianSpartacus on topic Prevent admin edit of responses
Wow, thank you!! I really appreciate it!
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
8 years 9 months ago #122741
by DenisChenu
With 2.06 : we have before Permission event manual.limesurvey.org/BeforeHasPermission .
I think this hack can be put it beforeHasPermission event in a plugin, no ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Prevent admin edit of responses
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....
With 2.06 : we have before Permission event manual.limesurvey.org/BeforeHasPermission .
I think this hack can be put it beforeHasPermission event in a plugin, no ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.