@dis1
There are many approaches you can take, some of which eliminate the need to send updates each night. I have not used PowerSchool, so some of these may not be possibilities for you. This is a non-exhaustive list.
When uploading CSV files through the SIS import process, you have the option to override (or not) changes made through the UI. You also have the ability to make the changes sticky, which is what happens when changes are made through the UI. If you have control over the settings, you could upload the CSV for the restricted enrollments and use the add_sis_stickiness parameter (you may need to use the override_sis_stickiness as well). Then make sure that PowerSchool does not use the override. There wouldn't be a need to update nightly, only when enrollments for those restricted students change.
This may take some tweaking, you might need to send a deleted status with the stickiness parameter for the student enrollment. It may also be sufficient (I haven't tested) that marking the deleted status as sticky for the student enrollment works without changing the status on the restricted enrollments. Since users can have multiple enrollments within a course, Canvas would likely see the student enrollment and restricted enrollment as two separate enrollments and since PowerSchool doesn't know about the restricted enrollment, it would never try to delete it (and so you wouldn't need to mark it as sticky).
You can specify custom roles with the CSV import and you can automate the CSV imports through the API. If you cannot change the settings on the PowerSchool import, then you could wait until it had been processed and then run a second import of the restricted students. This potentially creates a delay between when the PowerSchool import runs and your custom import runs. That would leave the students able to send messages during that time.
I do not know whether imports are processed in sequence, but there is a comment under the abort SIS import endpoint that suggests that only one is processed at a time. If you were sure that the PowerSchool import had started processing, then you might be able to upload the custom import right away. I don't do this myself (I always check the status before sending a new import and refuse to send the new one if the old one hasn't finished) so I cannot verify that.
If you have a few students with this restriction, you can use the Enrollments API to make the changes. If you have a lot of students and are already using the CSV import (you are through PowerSchool), I would recommend sticking with one of the first two options.
First, enroll a user with the restrictions so they are in the course twice. Enrolling by the custom role name is marked as deprecated, so you'll need to the custom role ID. Then use the conclude, deactivate, or delete an enrollment endpoint to remove the access for the regular student enrollment. You might think that you should delete first and then add, but I'm trying to avoid the situation where the student gets deleted and then something happens and they don't get added back or they're in the middle of a quiz and get booted or something else bad.
I don't use Canvas' cross-listing mechanism (I wrote my own system), but enrollments can be made at the course level or the section level, so you would want to mimic what was done via the CSV uploads.
This discussion post is outdated and has been archived. Please use the Community question forums and official documentation for the most current and accurate information.