From 3f71011668abbc2ec31f3f6e10256ea1c96e159b Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Fri, 1 Dec 2023 10:34:35 +0000 Subject: [PATCH] MDL-69497 mod_assign: amend preference definitions for current user. Ensure they can always be updated when using the grader. --- mod/assign/lib.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mod/assign/lib.php b/mod/assign/lib.php index 8d23b704de2..c97f123fd95 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -1752,24 +1752,29 @@ function mod_assign_core_calendar_event_timestart_updated(\calendar_event $event /** * Return a list of all the user preferences used by mod_assign. * - * @return array + * @uses core_user::is_current_user + * + * @return array[] */ -function mod_assign_user_preferences() { +function mod_assign_user_preferences(): array { $preferences = array(); $preferences['assign_filter'] = array( 'type' => PARAM_ALPHA, 'null' => NULL_NOT_ALLOWED, - 'default' => '' + 'default' => '', + 'permissioncallback' => [core_user::class, 'is_current_user'], ); $preferences['assign_workflowfilter'] = array( 'type' => PARAM_ALPHA, 'null' => NULL_NOT_ALLOWED, - 'default' => '' + 'default' => '', + 'permissioncallback' => [core_user::class, 'is_current_user'], ); $preferences['assign_markerfilter'] = array( 'type' => PARAM_ALPHANUMEXT, 'null' => NULL_NOT_ALLOWED, - 'default' => '' + 'default' => '', + 'permissioncallback' => [core_user::class, 'is_current_user'], ); return $preferences;