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

New Web Service core_group_get_activity_allowed_groups

    XMLWordPrintable

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.9
    • 3.0
    • Groups, Web Services
    • MOODLE_29_STABLE
    • MOODLE_30_STABLE
    • MDL-50966-master
    • Hide
      1. Create a course with group mode "Separate groups" Forced
      2. Enrol a user as a student and another user as editing teacher
      3. Create two groups, enrol both users in the two groups
      4. Create a grouping including only one group
      5. Create two activities that support groups (like forum)
      6. Configure one of those activities to use Groupings and choose the grouping selected
      7. As admin, enable "Mobile services": Plugins ► Web Services ► Mobile
      8. Create a Token for the student and teacher user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      9. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You need to replace the wstoken, cmid (with the course module id of the activity not using groupings) and the URL of your moodle instance

          curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'cmid=125&wsfunction=core_group_get_activity_allowed_groups&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool"

      10. Confirm that you receive a json structure containing the information of all the user groups
      11. Now, replace cmid with the course module id of the activity using groupings and run the curl command again
      12. You should receive now a response containing only one group (the one in the grouping)
      13. Using the teacher wstoken run the same curl requests but adding and additional parameter: userid=X (X is the student user id), you should see the same response
      14. Run the same commands using a valid user id of a user not enrolled in the course, you should see a warning saying: User X is not enrolled in course Y"
      15. Run the same commands with an invalid user id you should receive a error: invaliduser
      Show
      Create a course with group mode "Separate groups" Forced Enrol a user as a student and another user as editing teacher Create two groups, enrol both users in the two groups Create a grouping including only one group Create two activities that support groups (like forum) Configure one of those activities to use Groupings and choose the grouping selected As admin, enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the student and teacher user: Click on Site administration ► Plugins ► Web services ► Manage tokens Next, you can do a CURL REST call simulating a WS client with the student user. You need to replace the wstoken, cmid (with the course module id of the activity not using groupings) and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'cmid=125&wsfunction=core_group_get_activity_allowed_groups&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Confirm that you receive a json structure containing the information of all the user groups Now, replace cmid with the course module id of the activity using groupings and run the curl command again You should receive now a response containing only one group (the one in the grouping) Using the teacher wstoken run the same curl requests but adding and additional parameter: userid=X (X is the student user id), you should see the same response Run the same commands using a valid user id of a user not enrolled in the course, you should see a warning saying: User X is not enrolled in course Y" Run the same commands with an invalid user id you should receive a error: invaliduser

    Description

      New Web Service for retrieving a list of groups that the user is allowed to access within the specified activity.

      It will be just a wrapper for the group_get_activity_allowed_groups core function

      Attachments

        Issue Links

          Activity

            People

              jleyva Juan Leyva
              jleyva Juan Leyva
              Simey Lameze Simey Lameze
              David Monllaó David Monllaó
              John Okely John Okely
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, Juan Leyva, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                16/Nov/15