Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64255

Edit Web Service for self unenrol from a course

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.6, 4.1
    • Enrolments
    • MOODLE_36_STABLE, MOODLE_401_STABLE
    • MDL-64255-main
    • Hide

      To test this with all possible scenarios I recommend to use just one enrol type, I'm adding the manual to the test instructions:

      1. Make sure the Manual enrolments plugin is enabled by going to `Site Administration->Plugins->Manage enrol plugins`. Enable if it is not already.
      2. Create a new course.
        a. Ensure that the Manual enrolments plugin is enabled for the course by going to `Course Settings->Enrolment Methods (click on select)`. Enable manual enrolment for the course if it isn't already enabled.
      3. Manual enrol to the course as two students by using the action menu toggle on the course page and add admin as a teacher in the course.
      4. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      5. Create a webservice access token by going to `Site Administration->Plugins->Web Services->Manage Tokens`.
        a. Create tokens for the student and the admin.
        b. Note down the tokens (wstoken)
      6. We use the following curl command to test if the webservice works as required, first as student1. Please note that the `$MOODLE_URL` , `$wstoken` and `$ueid` (put the ueid of the student2) are parameters that need to be filled by you.

        curl 'MOODLE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_enrol_unenrol_user_enrolment&wstoken=$wstoken&ueid=$ueid' --compressed 

      7. Ensure the response is a JSON object with a key `status` that should be false, indicating no unenrolment, because the student should not have this capability by default.
      8. Now make the same request with the admin wstoken
      9. Ensure the response is a JSON object with a key `status` that should be true, indicating the unenrolment was successful for the student2
      10. And now try to make the same request but change the wstoken for the student1 and the ueid for the student1
      11. Ensure the response is a JSON object with a key `status` that should be false, indicating no unenrolment, because the student should not have this capability by default.
      12. Add the capability to enrol/manual:unenrolself to the student: Permissions/ Define roles/ Student
      13. Try again, ensure the response is a JSON object with a key `status` that should be true, indicating the self unenrolment was successful for the student1
      14. Try again, ensure the response is a JSON object with a key `status` that should be false, indicating no self unenrolment
      Show
      To test this with all possible scenarios I recommend to use just one enrol type, I'm adding the manual to the test instructions: Make sure the Manual enrolments plugin is enabled by going to `Site Administration->Plugins->Manage enrol plugins`. Enable if it is not already. Create a new course. a. Ensure that the Manual enrolments plugin is enabled for the course by going to `Course Settings->Enrolment Methods (click on select)`. Enable manual enrolment for the course if it isn't already enabled. Manual enrol to the course as two students by using the action menu toggle on the course page and add admin as a teacher in the course. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a webservice access token by going to `Site Administration->Plugins->Web Services->Manage Tokens`. a. Create tokens for the student and the admin. b. Note down the tokens (wstoken) We use the following curl command to test if the webservice works as required, first as student1. Please note that the `$MOODLE_URL` , `$wstoken` and `$ueid` (put the ueid of the student2) are parameters that need to be filled by you. curl 'MOODLE_URL/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_enrol_unenrol_user_enrolment&wstoken=$wstoken&ueid=$ueid' --compressed Ensure the response is a JSON object with a key `status` that should be false, indicating no unenrolment, because the student should not have this capability by default. Now make the same request with the admin wstoken Ensure the response is a JSON object with a key `status` that should be true, indicating the unenrolment was successful for the student2 And now try to make the same request but change the wstoken for the student1 and the ueid for the student1 Ensure the response is a JSON object with a key `status` that should be false, indicating no unenrolment, because the student should not have this capability by default. Add the capability to enrol/manual:unenrolself to the student: Permissions/ Define roles/ Student Try again, ensure the response is a JSON object with a key `status` that should be true, indicating the self unenrolment was successful for the student1 Try again, ensure the response is a JSON object with a key `status` that should be false, indicating no self unenrolment

      We need a new WS for allowing a user to self unenrol from a course

            jleyva Juan Leyva
            jleyva Juan Leyva
            Ilya Tregubov Ilya Tregubov
            Andrew Lyons Andrew Lyons
            Votes:
            1 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 week, 2 days, 5 hours, 31 minutes
                1w 2d 5h 31m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.