We have been using web services to create groups and enrol users for a few years. We also use the web services to unenrol users too. Or so we thought.
Once a user should no longer have access to a course, the web service runs and removes the relevant row from mdl_role_assignments table. However, the equivalent row remains in the mdl_user_enrolments table.
When we call the web services to enrol users we call both functions core_role_assign and enrol_manual_enrol_users. However, for unenrolments, there is only the core_role_unassign function.
How can we remove the user enrolment as well?
(We are also creating groups and putting users into them. If we don't use the enrol_manual_enrol_users function, it complains that we can't put them into the group because they're not enrolleed on the course).
Any help or guidance would be appreciated.