diff --git a/classes/view_responselist.php b/classes/view_responselist.php index 32bf6d16570..454ae31371a 100644 --- a/classes/view_responselist.php +++ b/classes/view_responselist.php @@ -1005,6 +1005,7 @@ public function show_action_buttons($tifirst, $tilast) { $candeleteownsubmissions = has_capability('mod/surveypro:deleteownsubmissions', $this->context); $candeleteotherssubmissions = has_capability('mod/surveypro:deleteotherssubmissions', $this->context); + $canenjoydeleteallsubmissionsbutton = has_capability('mod/surveypro:enjoydeleteallsubmissionsbutton', $this->context); $canseeotherssubmissions = has_capability('mod/surveypro:seeotherssubmissions', $this->context); $userid = ($canseeotherssubmissions) ? null : $USER->id; @@ -1021,6 +1022,7 @@ public function show_action_buttons($tifirst, $tilast) { $deleteall = true; $deleteall = $deleteall && $candeleteownsubmissions; $deleteall = $deleteall && $candeleteotherssubmissions; + $deleteall = $deleteall && $canenjoydeleteallsubmissionsbutton; $deleteall = $deleteall && empty($this->searchquery); $deleteall = $deleteall && empty($tifirst); // Hide the deleteall button if not all the responses are shown. $deleteall = $deleteall && empty($tilast); // Hide the deleteall button if not all the responses are shown. diff --git a/db/access.php b/db/access.php index 89414d76c50..ca41ba676b9 100644 --- a/db/access.php +++ b/db/access.php @@ -63,6 +63,7 @@ * File: view.php, $section = 'submissionslist' * * mod/surveypro:alwaysseeowner + * mod/surveypro:enjoydeleteallsubmissionsbutton * * mod/surveypro:seeownsubmissions <-- It does not actually exist. It is always allowed. * mod/surveypro:seeotherssubmissions @@ -204,6 +205,17 @@ ], ], + 'mod/surveypro:enjoydeleteallsubmissionsbutton' => [ + 'riskbitmask' => RISK_DATALOSS, + 'captype' => 'write', + 'contextlevel' => CONTEXT_MODULE, + 'archetypes' => [ + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW, + ], + ], + 'mod/surveypro:seeotherssubmissions' => [ 'riskbitmask' => RISK_PERSONAL, 'captype' => 'write', @@ -216,7 +228,7 @@ ], 'mod/surveypro:editownsubmissions' => [ - 'riskbitmask' => RISK_CONFIG | RISK_PERSONAL, + 'riskbitmask' => RISK_PERSONAL, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -227,7 +239,7 @@ ], 'mod/surveypro:editotherssubmissions' => [ - 'riskbitmask' => RISK_CONFIG | RISK_PERSONAL, + 'riskbitmask' => RISK_PERSONAL, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -238,7 +250,7 @@ ], 'mod/surveypro:duplicateownsubmissions' => [ - 'riskbitmask' => RISK_CONFIG | RISK_PERSONAL, + 'riskbitmask' => RISK_PERSONAL, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -249,7 +261,7 @@ ], 'mod/surveypro:duplicateotherssubmissions' => [ - 'riskbitmask' => RISK_CONFIG | RISK_PERSONAL, + 'riskbitmask' => RISK_PERSONAL, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -260,7 +272,7 @@ ], 'mod/surveypro:deleteownsubmissions' => [ - 'riskbitmask' => RISK_CONFIG, + 'riskbitmask' => RISK_DATALOSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -271,7 +283,7 @@ ], 'mod/surveypro:deleteotherssubmissions' => [ - 'riskbitmask' => RISK_CONFIG, + 'riskbitmask' => RISK_DATALOSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -383,7 +395,7 @@ ], 'mod/surveypro:importresponses' => [ - 'riskbitmask' => RISK_CONFIG | RISK_PERSONAL, + 'riskbitmask' => RISK_PERSONAL, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -395,7 +407,7 @@ ], 'mod/surveypro:exportresponses' => [ - + 'riskbitmask' => RISK_PERSONAL, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -407,7 +419,7 @@ ], 'mod/surveypro:manageusertemplates' => [ - + 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -417,7 +429,7 @@ ], 'mod/surveypro:deleteusertemplates' => [ - 'riskbitmask' => RISK_CONFIG, + 'riskbitmask' => RISK_DATALOSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -437,7 +449,7 @@ ], 'mod/surveypro:saveusertemplates' => [ - 'riskbitmask' => RISK_PERSONAL, + 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, 'archetypes' => [ @@ -447,7 +459,7 @@ ], 'mod/surveypro:importusertemplates' => [ - + 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -457,7 +469,7 @@ ], 'mod/surveypro:applyusertemplates' => [ - 'riskbitmask' => RISK_CONFIG, + 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ @@ -477,7 +489,7 @@ ], 'mod/surveypro:applymastertemplates' => [ - 'riskbitmask' => RISK_CONFIG, + 'riskbitmask' => RISK_XSS, 'captype' => 'write', 'contextlevel' => CONTEXT_MODULE, 'archetypes' => [ diff --git a/lang/en/surveypro.php b/lang/en/surveypro.php index b3efd61d069..459134ffd89 100644 --- a/lang/en/surveypro.php +++ b/lang/en/surveypro.php @@ -477,6 +477,7 @@ $string['surveypro:duplicateownsubmissions'] = 'Duplicate own responses'; $string['surveypro:editotherssubmissions'] = 'Edit responses from other users'; $string['surveypro:editownsubmissions'] = 'Edit own responses'; +$string['surveypro:enjoydeleteallsubmissionsbutton'] = 'Enjoy the "Delete all submissions" button'; $string['surveypro:exportresponses'] = 'Export collected responses'; $string['surveypro:ignoremaxentries'] = 'Submissions are not limited by max entries setting'; $string['surveypro:importresponses'] = 'Import data'; diff --git a/version.php b/version.php index 462c1ecad64..b9355014f47 100644 --- a/version.php +++ b/version.php @@ -26,6 +26,6 @@ $plugin->component = 'mod_surveypro'; $plugin->maturity = MATURITY_BETA; -$plugin->version = 2024062403; -$plugin->release = '4.4'; -$plugin->requires = 2024042200; +$plugin->version = 2024070600; +$plugin->release = '4.5'; +$plugin->requires = 2024100700;