Skip to content

Commit

Permalink
Fixed issue #14216: Users without rights to delete tokens can still d…
Browse files Browse the repository at this point in the history
…elete them

Dev: disable action , hide button come after
Dev: deleteToken must use POST : db update => must be post
  • Loading branch information
Shnoulle committed Nov 6, 2018
1 parent 38c9154 commit dfa62ac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions application/controllers/admin/tokens.php
Expand Up @@ -241,9 +241,11 @@ public function bounceprocessing($iSurveyId)
*/
public function deleteMultiple()
{
// TODO: permission checks
$aTokenIds = json_decode(Yii::app()->getRequest()->getPost('sItems'));
$iSid = Yii::app()->getRequest()->getPost('sid');
if (!Permission::model()->hasSurveyPermission($iSid, 'tokens', 'delete')) {
throw new CHttpException(403, gT("You do not have permission to access this page."));
}
TokenDynamic::model($iSid)->deleteRecords($aTokenIds);
return true;
}
Expand All @@ -253,9 +255,11 @@ public function deleteMultiple()
*/
public function deleteToken()
{
// TODO: permission checks
$aTokenId = Yii::app()->getRequest()->getParam('sItem');
$iSid = Yii::app()->getRequest()->getParam('sid');
if (!Permission::model()->hasSurveyPermission($iSid, 'tokens', 'delete')) {
throw new CHttpException(403, gT("You do not have permission to access this page."));
}
TokenDynamic::model($iSid)->deleteRecords(array($aTokenId));
return true;
}
Expand Down

0 comments on commit dfa62ac

Please sign in to comment.