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

WS forum_can_add_discussion should return capabilities/permission information

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.3
    • Component/s: Forum, Web Services
    • Labels:
    • Testing Instructions:
      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.
    • Affected Branches:
      MOODLE_32_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-57390-master

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jleyva Juan Leyva
              Reporter:
              jleyva Juan Leyva
              Peer reviewer:
              Dani Palou
              Integrator:
              David Monllaó
              Tester:
              John Okely
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Juan Leyva, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                15/May/17