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

Task cohort_role_sync attempts to sync deleted users

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Steps to replicate

      1. Create a Cohort
      2. Add a user to the Cohort (remember this user)
      3. Add more users to this cohort
      4. Create a Role which can be assigned at the user level
      5. Go to Site administration / ► Users / ► Permissions / ► Assign user roles to cohort
      6. Choose the user from step 2 you've added to the Cohort from the 'Select users to assign role' dropdown
      7. Select the Cohort you created from the 'Select cohorts' dropdown
      8. Click Assign
      9. Go to Site administration / ► Server/ ► Scheduled task / ► Sync cohort role assignments ► Run now
      10. Click Run
      11. Go to Site administration / ► Users / ► Accounts / ► Browse list of users
      12. Find the user from step 2 you added to the Cohort and delete the user
      13. Go to Site administration / ► Server/ ► Scheduled task / ► Sync cohort role assignments ► Run now
      14. Click Run

      Task should run with no errors at all.

       

      Show
      Steps to replicate Create a Cohort Add a user to the Cohort (remember this user) Add more users to this cohort Create a Role which can be assigned at the user level Go to Site administration / ► Users / ► Permissions / ► Assign user roles to cohort Choose the user from step 2 you've added to the Cohort from the ' Select users to assign role'  dropdown Select the Cohort you created from the ' Select cohorts ' dropdown Click  Assign Go to Site administration / ► Server/ ► Scheduled task / ► Sync cohort role assignments ► Run now Click  Run Go to Site administration / ► Users / ► Accounts / ► Browse list of users Find the user from step 2 you added to the Cohort and  delete  the user Go to Site administration / ► Server/ ► Scheduled task / ► Sync cohort role assignments ► Run now Click  Run Task should run with no errors at all.  
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • Pull from Repository:

      Description

      Steps to replicate

      1. Create a Cohort
      2. Add a user to the Cohort (remember this user)
      3. Add more users to this cohort
      4. Create a Role which can be assigned at the user level
      5. Go to Site administration / ► Users / ► Permissions / ► Assign user roles to cohort
      6. Choose the user from step 2 you've added to the Cohort from the 'Select users to assign role' dropdown
      7. Select the Cohort you created from the 'Select cohorts' dropdown
      8. Click Assign
      9. Run the scheduled task -

        php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync --showdebugging

      10. Go to Site administration / ► Users / ► Accounts / ► Browse list of users
      11. Find the user from step 2 you added to the Cohort and delete the user
      12. Run the scheduled task -

        php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync --showdebugging

      You will get an error stating that the task failed due to the user ID not existing/being deleted.

      I could work around the issue by going into the database and editing the deleted flag in the database to 0, then run the scheduled task so it completes, then mark the user as deleted in the database again.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                jamie.biddulph Jamie Biddulph
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                2 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated: