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

Move get_user_badges WS from badges/classes/external to a separate file

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 5.0
    • Badges
    • MOODLE_500_STABLE
    • MDL-83903-master
    • Hide
      1. Login as admin.
      2. Create a new user: U1.
      3. Create 2 new badges.
      4. Enable both badges.
      5. Award both badges to U1.
      6. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings
      7. Create a Token in the mobile app service for the user U1 and for the admin.
        • Click on Site administration ► Plugins ► Web services ► Manage tokens
      8. Open the console an execute this new curl request, replacing wstoken with the token for U1 and the site url with yours.

        curl --location --request POST 'http://localhost/moodle/webservice/rest/server.php?wstoken=b24d9411d71ed51d81ff382e44f21ea3&wsfunction=core_badges_get_user_badges'

      1. After executing the WS check that:
        • You receive both badges
        • You only see the id and name of related badges, and you can only see the id, targetname and targeturl of the competencies.
      2. Now open the console an execute this new curl request, replacing wstoken with the token for the admin user, the site url with yours and the userid with the U1 id.

        curl --location --request POST 'http://localhost/moodle/webservice/rest/server.php?wstoken=b24d9411d71ed51d81ff382e44f21ea3&wsfunction=core_badges_get_user_badges&userid=3'

      1. After executing the WS check that:
        • You receive both badges
      Show
      Login as admin. Create a new user: U1. Create 2 new badges. Enable both badges. Award both badges to U1. Enable "Mobile services": Site administration ► Mobile app ► Mobile settings Create a Token in the mobile app service for the user U1 and for the admin. Click on Site administration ► Plugins ► Web services ► Manage tokens Open the console an execute this new curl request, replacing wstoken with the token for U1 and the site url with yours. curl --location --request POST 'http://localhost/moodle/webservice/rest/server.php?wstoken=b24d9411d71ed51d81ff382e44f21ea3&wsfunction=core_badges_get_user_badges' After executing the WS check that: You receive both badges You only see the id and name of related badges, and you can only see the id, targetname and targeturl of the competencies. Now open the console an execute this new curl request, replacing wstoken with the token for the admin user , the site url with yours and the userid with the U1 id. curl --location --request POST 'http://localhost/moodle/webservice/rest/server.php?wstoken=b24d9411d71ed51d81ff382e44f21ea3&wsfunction=core_badges_get_user_badges&userid=3' After executing the WS check that: You receive both badges
    • Hide

      Code verified against automated checks.

      Checked MDL-83903 using repository: https://github.com/ngtrdai/moodle

      More information about this report

      Built on: Fri Mar 28 04:06:28 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-83903 using repository: https://github.com/ngtrdai/moodle main (0 errors / 0 warnings) [branch: MDL-83903-master | CI Job ] More information about this report Built on: Fri Mar 28 04:06:28 UTC 2025
    • 2
    • C->HQ 2025 Sprint I2.2 Moppies

      Move get_user_badges from badges/classes/external.php to badges/classes/external/get_user_badges.php.

            ngtrdai Dai Nguyen Trong
            sarjona Sara Arjona (@sarjona)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

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