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

Return if the current user is admin in the core_webservice_get_siteinfo WS

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.6.3, 3.8
    • Fix Version/s: 3.8
    • Component/s: Web Services
    • Labels:
    • Testing Instructions:
      Hide
      1. Enable "Mobile services": Plugins ► Web Services ► Mobile
      2. Create a Token for the site administrator and for any student or just authenticated user:
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
        • Click add, select user and service (Mobile Service)
      3. Next, you can do a CURL REST call simulating a WS client:
        • You need to replace the wstoken first with the site administrator token and the URL of your moodle instance

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

      4. Confirm that in the response you receive the following field: userissiteadmin set to true
      5. Now, replace the token in the curl request with the normal student/authenticated user one.
      6. Execute again the curl request and check that now the userissiteadmin field is set to false
      Show
      Enable "Mobile services": Plugins ► Web Services ► Mobile Create a Token for the site administrator and for any student or just authenticated user: Click on Site administration ► Plugins ► Web services ► Manage tokens Click add, select user and service (Mobile Service) Next, you can do a CURL REST call simulating a WS client: You need to replace the wstoken first with the site administrator token and the URL of your moodle instance curl 'http://localhost/m/stable_master/webservice/rest/server.php?moodlewsrestformat=json' --data 'wsfunction=core_webservice_get_site_info&wstoken=e8a8eb4410ad85d6f76ffc7a908fb65a' --compressed | python -m "json.tool" Confirm that in the response you receive the following field: userissiteadmin set to true Now, replace the token in the curl request with the normal student/authenticated user one. Execute again the curl request and check that now the userissiteadmin field is set to false
    • Affected Branches:
      MOODLE_36_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-65550-master

      Description

      We need to know if the current user is an admin to display certain relevant information

        Attachments

          Activity

            People

            Assignee:
            jleyva Juan Leyva
            Reporter:
            jleyva Juan Leyva
            Peer reviewer:
            Dani Palou
            Integrator:
            Andrew Nicols
            Tester:
            Janelle Barcega
            Participants:
            Component watchers:
            Juan Leyva, Jake Dallimore, Jun Pataleta
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              18/Nov/19

                Time Tracking

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