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

WS forum_can_add_discussion should return capabilities/permission information

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 3.3
    • 3.2
    • Forum, Web Services
    • MOODLE_32_STABLE
    • MOODLE_33_STABLE
    • MDL-57390-master
    • Hide
      1. Create a new forum in a course (use default settings values)
      2. Enrol two users as student and teacher in the course
      3. As admin, enable "Mobile services": Site administration ► Mobile app ►  Mobile settings
      4. Create tokens for the two users:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      5. Next, you can do a CURL REST call simulating a WS client with the student user.
        • You  need to replace the wstoken (student one), formumid and the URL of your moodle instance

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

      1. Check that in the response you see the field canpindiscussions set to false and the field cancreateattachment is set to true
      2. Execute the same curl request again but using the teacher token and check that the field is now set to true (check that cancreateattachmentis set to true too)

      Now, a test for regressions:

      As admin configure the forum to don't allow attachments (max attachments number set to 0)

      Go to the forum -> add a new discussion and check that you don't see the file manager.

      Go back to the forum settings and enable attachments (set the number to 1 or any number > 0)

      Go to the forum -> add a new discussion and check that you see the file manager.

      Show
      Create a new forum in a course (use default settings values) Enrol two users as student and teacher in the course As admin, enable "Mobile services": Site administration ► Mobile app ►  Mobile settings Create tokens for the two users: 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 (student one), formumid and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'forumid=18&wsfunction=mod_forum_can_add_discussion&wstoken=ffbe3a3002f235bf9d01fd9369e10b66' | python -m "json.tool" Check that in the response you see the field canpindiscussions set to false and the field cancreateattachment is set to true Execute the same curl request again but using the teacher token and check that the field is now set to true (check that cancreateattachmentis set to true too) Now, a test for regressions: As admin configure the forum to don't allow attachments (max attachments number set to 0) Go to the forum -> add a new discussion and check that you don't see the file manager. Go back to the forum settings and enable attachments (set the number to 1 or any number > 0) Go to the forum -> add a new discussion and check that you see the file manager.

      For example, we would need to know if the user can create pinned discussions or not.

      the mod_forum_add_discussion WS already support pinned discussions, but we need this information to check if the user is able to add pinned discussions.

            jleyva Juan Leyva
            jleyva Juan Leyva
            Dani Palou Dani Palou
            David Monllaó David Monllaó
            John Okely John Okely
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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