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

core_group_get_course_user_groups should return all user courses group information

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.6
    • Component/s: Groups
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a couple of new courses configured to use groups
      2. In the two courses create at least one group
      3. Enrol one user as student and another one as teacher in both courses and assign him to the course group
      4. As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      5. Create a Token in the mobile app service for the student and teacher users:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      6. Next, you can do a CURL REST call simulating a WS client with the user.
        • You need to replace the wstoken with the student one, and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_group_get_course_user_groups&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool"

      7. Execute the CURL request and check that you receive all the groups where the user was enrolled
      8. Now, add the following parameter to the CURL request &courseid=ID_OF_ONE_OF_YOUR_COURSES and check that the curl request now returns the group of the course indicated in courseid
      9. Now replace the courseid with 0 and add the parameter &userid=USER_ID with the student id, check the curl request now returns all the courses groups again
      10. Now, use the latest CURL request but replacing the wstoken with the teacher one and check that you receive all the user courses groups again
      11. Unenroll the teacher from one of the courses and now execute again the last curl request to check that now you receive only the groups from the course the teacher is enrolled and you also receive a warning
      12. Now, create a token for a normal user in the platform (no admin) that is not enrolled in both courses and execute the latest curl request, you should get warnings too
      Show
      Create a couple of new courses configured to use groups In the two courses create at least one group Enrol one user as student and another one as teacher in both courses and assign him to the course group As admin, enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the student and teacher users: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the user. You need to replace the wstoken with the student one, and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_group_get_course_user_groups&wstoken=12a2a65aeea2a177055e233f9e303218' | python -m "json.tool" Execute the CURL request and check that you receive all the groups where the user was enrolled Now, add the following parameter to the CURL request &courseid=ID_OF_ONE_OF_YOUR_COURSES and check that the curl request now returns the group of the course indicated in courseid Now replace the courseid with 0 and add the parameter &userid=USER_ID with the student id, check the curl request now returns all the courses groups again Now, use the latest CURL request but replacing the wstoken with the teacher one and check that you receive all the user courses groups again Unenroll the teacher from one of the courses and now execute again the last curl request to check that now you receive only the groups from the course the teacher is enrolled and you also receive a warning Now, create a token for a normal user in the platform (no admin) that is not enrolled in both courses and execute the latest curl request, you should get warnings too
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-61197-master

      Description

      In order to avoid multiple calls via the mobile app we should be able to retrieve all the user course groups when the course indicated is 0

      This will improve a lot the app performance

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h