Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-79781

Error in Courses Pending approval when the default role is deleted

XMLWordPrintable

    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-79781-401
    • MDL-79781-403
    • Hide
      1. Log in as admin
      2. Navigate to Users > Permissions > Define roles in site administration
      3. Delete the Teacher role
      4. Edit the Authenticated user role
      5. Allow the moodle/course:request capability
      6. Create a new user
      7. Log out
      8. Log in as new user
      9. Navigate to My courses
      10. Press Request a course
      11. Fill in the form and save the form
      12. Log out
      13. Log in as admin
      14. Navigate to Courses > Pending requests in site administration
      15. Confirm there is no exception
      16. Confirm you see the following message:

        The creators' role in new courses configuration is invalid. Please see user policies.
        

      17. Press the user policies link
      18. Change Creators' role in new courses setting to Manager (manager) and save
      19. Navigate back to Pending requests in site administration
      20. Confirm you see the following message:

        The user requesting this course will be automatically enrolled and assigned the role of Manager. 
        

      Show
      Log in as admin Navigate to Users > Permissions > Define roles in site administration Delete the Teacher role Edit the Authenticated user role Allow the moodle/course:request capability Create a new user Log out Log in as new user Navigate to My courses Press Request a course Fill in the form and save the form Log out Log in as admin Navigate to Courses > Pending requests in site administration Confirm there is no exception Confirm you see the following message: The creators' role in new courses configuration is invalid. Please see user policies. Press the user policies link Change Creators' role in new courses setting to Manager (manager) and save Navigate back to Pending requests in site administration Confirm you see the following message: The user requesting this course will be automatically enrolled and assigned the role of Manager.

      Steps to reporduce:

      1. Check the "Creators' role in new courses" value in the User policies admin ( /admin/settings.php?section=userpolicies) page. By default it is the 'Editing teacher'.
      2. Delete the 'editingteacher' role in the Manage roles admin page (/admin/roles/manage.php).
      3. Make a course request by any user with the right role ( Course requester role )
      4. Check the Courses Pending Approval page (/course/pending.php). It will now show the "Can't find data record in database table role.
        Debug details:

        Debug info: SELECT * FROM {role} WHERE id = ?
        [array (
        0 => '3',
        )]
        Error code: invalidrecord Stack trace:
         
            line 1658 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
            line 1634 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
            line 113 of /course/pending.php: call to moodle_database->get_record()
        

      Expected behavior:
      Error should point to the correct cause (something like 'The default value for the creator role is not valid, please fix it in your settings')
      Event better, when deleting the role used for creatornewroleid and restorernewroleid there could be a warning to update the Creator's role value or automatically update to the closest role.

      Workaround:
      This is an easy to solve issue once detected:
      #Check again the User policies admin page. The Creators' role in new courses option is tagged with the 'Invalid current value' warning

      1. Update the policies page with a valid role in the list.
      2. The error in the courses pending approval page is gone.

            pholden Paul Holden
            eduardcercos Eduard Cercós
            David Woloszyn David Woloszyn
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            17 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 28 minutes
                1h 28m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.