Hello everyone,
I have a external server that uses webservices to create the enrollments and activate and deactivate them. We are using `core_enrol_edit_user_enrolment` but it is marked deprecated and since 311 (IIRC) it can not be even added to the allowed webservice functions. So I'm migrating to use `core_enrol_submit_user_enrolment_form`.
But the documentation is very lacking and I think there is some bug that prevents it to be used at all from the external webservice.
For my usage the old function had `ueid` and `status`, but the new one has only `userform` which is not very descriptive. Investigating it looks like i can just put my data there URL encoded, as the web UI does. And I get further, but I get `{'result': False, 'validationerror': True}` which sounds like it does not like my data.
Investigating further, and inspecting differences with the web UI request, it seems to want a session key. So that lets me think that this function is working ONLY on the web ui, but not webservices.
Anybody knows more? Anybody has `core_enrol_submit_user_enrolment_form` from an external service?
If not, anybody can point me on whats are needed and I prepare a patch so that it works securely for next releases?
curl https://mymoodle.example.com/moodle/webservice/rest/server.php -X POST \
-d"formdata=ue%3d2018%26status%3d0" \
-dwstoken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
-dmoodlewsrestformat=json \
-dwsfunction=core_enrol_submit_user_enrolment_form
{"result":false,"validationerror":true}
```