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

Task cohort_role_sync attempts to sync deleted users

    • MOODLE_32_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • wip-MDL-60160-master
    • Easy
    • Hide
      1. Create a cohort
      2. Add more than one user to the cohort
      3. Create a role which can be assigned at the user level
      4. Go to Site administration / Users / Permissions / Assign user roles to cohort
      5. Assign the role to one of the users you added to the cohort. Remember this user
      6. Go to Site administration / Server / Scheduled task / Sync cohort role assignments / Run now
      7. Delete the user from step 5
      8. Run the scheduled task again
      9. Confirm the task runs with no errors at all.
      Show
      Create a cohort Add more than one user to the cohort Create a role which can be assigned at the user level Go to Site administration / Users / Permissions / Assign user roles to cohort Assign the role to one of the users you added to the cohort. Remember this user Go to Site administration / Server / Scheduled task / Sync cohort role assignments / Run now Delete the user from step 5 Run the scheduled task again Confirm the task runs with no errors at all.

      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.

            Unassigned Unassigned
            jamie.biddulph Jamie Biddulph
            Votes:
            2 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:

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

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