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

Add an additional return field in get_forums_by_courses in order to specify if the current user can create discussions

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create in a new course a general forum. Ensure that the course has the news forum enabled.
      2. Enrol a user as student in the course
      3. Add a discussion in each forum (in the new forum as teacher in the general forum as student)
      4. Enable "Mobile services": Plugins ► Web Services ► Mobile
      5. You need a token for the user for the Mobile Service, for creating a Token:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
        • Click add, select user and service (Mobile Service)
          all the forum discussions
      6. Execute the following CURL command in a shell (replace courseids - 4 value - with your course id and wstoken with your token)

        curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json'  --data 'courseids%5B0%5D=4&wsfunction=mod_forum_get_forums_by_courses&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true'  | python -m "json.tool"
        

      7. Confirm that you receive a list of forums and that the field cancreatediscussions is false for the news forum and true for the other forum
      Show
      Create in a new course a general forum. Ensure that the course has the news forum enabled. Enrol a user as student in the course Add a discussion in each forum (in the new forum as teacher in the general forum as student) Enable "Mobile services": Plugins ► Web Services ► Mobile You need a token for the user for the Mobile Service, for creating a Token: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) all the forum discussions Execute the following CURL command in a shell (replace courseids - 4 value - with your course id and wstoken with your token) curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'courseids%5B0%5D=4&wsfunction=mod_forum_get_forums_by_courses&wstoken=ffbe3a3002f235bf9d01fd9369e10b66&moodlewssettingfilter=true' | python -m "json.tool" Confirm that you receive a list of forums and that the field cancreatediscussions is false for the news forum and true for the other forum
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-51413-master

      Description

      Currently, get_forum_discussion_posts, returns a field called "canreply" that indicates if the user is able to reply to the forum posts

      It should be great to have a similar field in get_forums_by_courses so we can have information about the user capability to create discussions

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jleyva Juan Leyva
                Reporter:
                jleyva Juan Leyva
                Peer reviewer:
                Dani Palou
                Integrator:
                Andrew Nicols
                Tester:
                John Okely
                Participants:
                Component watchers:
                Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Jake Dallimore, Jun Pataleta, Ryan Wyllie
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  16/Nov/15