Moodle
  1. Moodle
  2. MDL-29276 META- Web service improvements for 2.2
  3. MDL-29931

Review SQL statement in login/token.php and remove unneeded join and selects

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2
    • Fix Version/s: 2.2
    • Component/s: Web Services
    • Labels:
      None
    • Testing Instructions:
      Hide

      1- create a web service (enabled and authorised for a specific username)
      2- in the mysql/postgres 'external_services' table, set manually the SHORTNAME
      3- Enter in your browser: http://yourmoodle/login/token.php?service=SHORTNAME&username=USERNAME&password=PASSWORD

      //use a no-admin user who has the moodle/webservice:createtoken capability
      a) the user never visited his security keys page (i.e. no token exists for him) and everything is set up correctly => a token is returned
      b) you run a) a new time (so a token has been generated) => the same token is returned.

      Show
      1- create a web service (enabled and authorised for a specific username) 2- in the mysql/postgres 'external_services' table, set manually the SHORTNAME 3- Enter in your browser: http://yourmoodle/login/token.php?service=SHORTNAME&username=USERNAME&password=PASSWORD //use a no-admin user who has the moodle/webservice:createtoken capability a) the user never visited his security keys page (i.e. no token exists for him) and everything is set up correctly => a token is returned b) you run a) a new time (so a token has been generated) => the same token is returned.
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull Master Branch:
    • Rank:
      19321

      Description

      The SQL statement within login/token.php that is selecting all of the applicable tokens for the user + service joins on the service and then selects several fields from it.
      However after the refactoring done in MDL-29716 this join and selects no longer appear to be needed (the service is fetched above and we can use the id from there in the where directly).

        Issue Links

          Activity

          Hide
          Dongsheng Cai added a comment -

          Looks good to me

          Show
          Dongsheng Cai added a comment - Looks good to me
          Hide
          Jérôme Mouneyrac added a comment -

          Thanks Dongsheng, submitting for integration.

          Show
          Jérôme Mouneyrac added a comment - Thanks Dongsheng, submitting for integration.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Yeah, far better if $service is already there, integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Yeah, far better if $service is already there, integrated, thanks!
          Hide
          Sam Hemelryk added a comment -

          Thanks guys - passing this now

          Show
          Sam Hemelryk added a comment - Thanks guys - passing this now
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Yes, you got this finally upstream, just in time for Moodle 2.2beta. Congrats and thanks!

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Yes, you got this finally upstream, just in time for Moodle 2.2beta. Congrats and thanks! Ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: