Skip to content

Commit

Permalink
forgot to add authorize to reset
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsguides committed Jul 27, 2023
1 parent 440f3dc commit e7f0c3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions administrator/components/com_yaquiz/src/Model/YaquizModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,13 @@ public function getIndividualAttemptResult($pk = 0, $attempt_id = 0){

//clears all general and individual results saved for a quiz
public function resetAllStatsAndRecords($quiz_id){

//user needs core.delete permission
$user = Factory::getApplication()->getIdentity();
if (!$user->authorise('core.delete', 'com_yaquiz')) {
throw new Exception(Text::_('JERROR_ALERTNOAUTHOR'));
}

$db = Factory::getContainer()->get('DatabaseDriver');
$query = $db->getQuery(true);
$query->delete('#__com_yaquiz_results_general');
Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_yaquiz/yaquiz.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<author>KevinsGuides</author>
<authorEmail>[email protected]</authorEmail>
<authorUrl>https://kevinsguides.com</authorUrl>
<version>0.4.01</version>
<version>0.4.02</version>
<description>COM_YAQUIZ_XML_DESCRIPTION</description>
<namespace path="src/">KevinsGuides\Component\Yaquiz</namespace>
<license>http://www.gnu.org/copyleft/gpl.html GNU/GPL</license>
Expand Down

0 comments on commit e7f0c3d

Please sign in to comment.