We used to temporarily block access to courses while keeping data by setting the course-status of the user to "suspended". As I understand it, the user should not have access to the course while suspended. There is only manual enrolment and no guest access to these courses.
Today I realized, that users who are suspended in a course still have access to that course. This is the case all over the whole platform.
I never tested this before today, as I am not the only admin and was never confronted with this aspect, so I don't know if it ever worked on this moodle instance, but I suppose it would have shown up earlier if it had never worked.
We are now on Moodle 3.5 branch
Edit: When setting the status to "suspended" the role "student" does not get removed. Only when setting the status to "suspended" AND manually removing the role of "student" the access to the course is blocked. That results in data being kept and having the student without any role listed in the course.
role:student + suspended = accessible
no role + active = accessible
no role + suspended = blocked
There is still one strange thing though, and I am not sure whether it is a bug or a feature:
There is a course with guest access where the accessibility to specific content is governed by group-membership. When students are member of a group, and their course-enrolment is suspended, they can still access the course and content of the group. Of course I would expect them to be able to access the regular content when logged in as a guest, but not to be able to access the group-content when logged into their account, as they would be suspended for - as I'd expect - all course content including group-content.
Or does the group-level permission overrule the course-level permission in this scenario?