Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.8
-
MOODLE_38_STABLE
-
MOODLE_37_STABLE, MOODLE_38_STABLE
-
MDL-67458-master -
Hide
Test 1: Deleting the cohort role assignment without syncing first
As admin:
- Clone new site (mdk create -v BRANCH)
- Checkout last week's weekly:
- Master: git checkout 8cf4c97217230e74
- 38: git checkout 773b1f738fa
- 37: git checkout fcc93935bea
- Install the site
- Create a cohort and add some users to it, including user t1 (or any user, just remember their username)
- Create a new role 'cohortmanager', based on manager (Admin -> Users -> Define roles) and make sure to check the "User" box next to the "Context types where this role may be assigned" option.
- Now, via the cohorts role assign page (Admin -> Users -> Assign user roles to cohort), assign the cohortmanager role to the t1 user for that cohort.
- Now, go back to define roles via system admin
- Delete the 'cohort manager' role
- Now, run the sync task:
php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync
Verify you see a bunch of errors
- Now, checkout HEAD (git checkout master or git checkout MOODLE_38_STABLE, etc)
- Run the upgrade
- Verify the upgrade runs without any errors
- Now, run the following query (change table prefix as needed):
select t.*, r.id from mdl_tool_cohortroles t left join mdl_role r on t.roleid = r.id where r.id is null;
Verify there are 0 results;
- Now, run the following query (change table prefix as needed):
select ra.*, r.id from mdl_role_assignments ra left join mdl_role r on ra.roleid = r.id where r.id is null;
Verify there are 0 results;
- Now, run the sync task:
php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync
Verify the task completes without any errors
Test 2: Deleting the cohort role assignment after syncing
- Clone new site (mdk create -v BRANCH)
- Checkout last week's weekly:
- Master: git checkout 8cf4c97217230e74
- 38: git checkout 773b1f738fa
- 37: git checkout fcc93935bea
- Install the site
- Create a cohort and add some users to it, including user t1 (or any user, just remember their username)
- Create a new role 'cohortmanager', based on manager (Admin -> Users -> Define roles) and make sure to check the "User" box next to the "Context types where this role may be assigned" option.
- Now, via the cohorts role assign page (Admin -> Users -> Assign user roles to cohort), assign the cohortmanager role to the t1 user for that cohort.
- Now, run the sync task:
php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync
- Delete the 'cohort manager' role
- Now, run the sync task:
php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync
You may see some errors. If so, that's ok.
- Now, checkout HEAD (git checkout master or git checkout MOODLE_38_STABLE, etc)
- Run the upgrade
- Verify the upgrade runs without any errors
- Now, run the following query (change table prefix as needed):
select t.*, r.id from mdl_tool_cohortroles t left join mdl_role r on t.roleid = r.id where r.id is null;
Verify there are 0 results;
- Now, run the following query (change table prefix as needed):
select ra.*, r.id from mdl_role_assignments ra left join mdl_role r on ra.roleid = r.id where r.id is null;
Verify there are 0 results;
- Now, run the sync task:
php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync
Verify the task completes without any errors
ShowTest 1: Deleting the cohort role assignment without syncing first As admin: Clone new site (mdk create -v BRANCH) Checkout last week's weekly: Master: git checkout 8cf4c97217230e74 38: git checkout 773b1f738fa 37: git checkout fcc93935bea Install the site Create a cohort and add some users to it, including user t1 (or any user, just remember their username) Create a new role 'cohortmanager', based on manager (Admin -> Users -> Define roles) and make sure to check the "User" box next to the "Context types where this role may be assigned" option. Now, via the cohorts role assign page (Admin -> Users -> Assign user roles to cohort), assign the cohortmanager role to the t1 user for that cohort. Now, go back to define roles via system admin Delete the 'cohort manager' role Now, run the sync task: php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync Verify you see a bunch of errors Now, checkout HEAD (git checkout master or git checkout MOODLE_38_STABLE, etc) Run the upgrade Verify the upgrade runs without any errors Now, run the following query (change table prefix as needed): select t.*, r.id from mdl_tool_cohortroles t left join mdl_role r on t.roleid = r.id where r.id is null; Verify there are 0 results; Now, run the following query (change table prefix as needed): select ra.*, r.id from mdl_role_assignments ra left join mdl_role r on ra.roleid = r.id where r.id is null; Verify there are 0 results; Now, run the sync task: php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync Verify the task completes without any errors Test 2: Deleting the cohort role assignment after syncing Clone new site (mdk create -v BRANCH) Checkout last week's weekly: Master: git checkout 8cf4c97217230e74 38: git checkout 773b1f738fa 37: git checkout fcc93935bea Install the site Create a cohort and add some users to it, including user t1 (or any user, just remember their username) Create a new role 'cohortmanager', based on manager (Admin -> Users -> Define roles) and make sure to check the "User" box next to the "Context types where this role may be assigned" option. Now, via the cohorts role assign page (Admin -> Users -> Assign user roles to cohort), assign the cohortmanager role to the t1 user for that cohort. Now, run the sync task: php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync Delete the 'cohort manager' role Now, run the sync task: php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync You may see some errors. If so, that's ok. Now, checkout HEAD (git checkout master or git checkout MOODLE_38_STABLE, etc) Run the upgrade Verify the upgrade runs without any errors Now, run the following query (change table prefix as needed): select t.*, r.id from mdl_tool_cohortroles t left join mdl_role r on t.roleid = r.id where r.id is null; Verify there are 0 results; Now, run the following query (change table prefix as needed): select ra.*, r.id from mdl_role_assignments ra left join mdl_role r on ra.roleid = r.id where r.id is null; Verify there are 0 results; Now, run the sync task: php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task\\cohort_role_sync Verify the task completes without any errors
Description
- Create a new role that can be assigned in the user context
- Create a cohort and add some users to it
- Assign the role from step 1 to users in the cohort
- Delete the role from step 1
- Run the cohort_role_sync task
- php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task
cohort_role_sync
- php admin/tool/task/cli/schedule_task.php --execute=\\tool_cohortroles\\task
- Boom
Attachments
- TEST1_Confirmed fix.png
- 355 kB
- TEST2_Confirmed fix.png
- 166 kB