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

Course badges can still be accessed though URL when course badges setting is disabled

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5
    • Component/s: Badges
    • Labels:
    • Testing Instructions:
      Hide

      1. The easiest way to test is to open the pages related to course badges (such as, badges/index.php, badges/view.php, badges/newbadge.php, badges/edit.php, badges/criteria.php, badges/overview.php, badges/recipients.php) .
      2. In site administration > badges settings, turn off course badges.
      3. Try reloading open pages.
      4. Should get an error that course badges are not currently enabled.

      Show
      1. The easiest way to test is to open the pages related to course badges (such as, badges/index.php, badges/view.php, badges/newbadge.php, badges/edit.php, badges/criteria.php, badges/overview.php, badges/recipients.php) . 2. In site administration > badges settings, turn off course badges. 3. Try reloading open pages. 4. Should get an error that course badges are not currently enabled.
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:
      MDL-39209_master

      Description

      Need to add checks for empty($CFG->badges_allowcoursebadges) on the front end pages.

        Gliffy Diagrams

          Activity

          Hide
          salvetore Michael de Raadt added a comment -

          Go for it.

          Show
          salvetore Michael de Raadt added a comment - Go for it.
          Hide
          markn Mark Nelson added a comment -

          Hi Yuliya,

          Patch looks good to me. Just a quick note -

          if (empty($CFG->badges_allowcoursebadges)) {
              print_error('coursebadgesdisabled', 'badges');
          } else {
              require_login($badge->courseid);
              $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid));
          }

          The else is not necessary in this statement, as the print_error will throw a moodle_exception and the rest of the code will not be executed.

          Show
          markn Mark Nelson added a comment - Hi Yuliya, Patch looks good to me. Just a quick note - if (empty($CFG->badges_allowcoursebadges)) { print_error('coursebadgesdisabled', 'badges'); } else { require_login($badge->courseid); $navurl = new moodle_url('/badges/index.php', array('type' => $badge->type, 'id' => $badge->courseid)); } The else is not necessary in this statement, as the print_error will throw a moodle_exception and the rest of the code will not be executed.
          Hide
          ybozhko Yuliya Bozhko added a comment -

          Thanks Mark!

          I applied suggested changes.

          Yuliya

          Show
          ybozhko Yuliya Bozhko added a comment - Thanks Mark! I applied suggested changes. Yuliya
          Hide
          markn Mark Nelson added a comment -

          HI Yuliya, thanks for that. I am submitting to integration.

          Show
          markn Mark Nelson added a comment - HI Yuliya, thanks for that. I am submitting to integration.
          Hide
          stronk7 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
          stronk7 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
          damyon Damyon Wiese added a comment -

          The change looks ok to me - phpunit passes - just waiting for behat.

          Show
          damyon Damyon Wiese added a comment - The change looks ok to me - phpunit passes - just waiting for behat.
          Hide
          damyon Damyon Wiese added a comment -

          behat passed!

          Show
          damyon Damyon Wiese added a comment - behat passed!
          Hide
          damyon Damyon Wiese added a comment -

          Thanks Yuliya,

          This change has been integrated to master. Off to testing now...

          Show
          damyon Damyon Wiese added a comment - Thanks Yuliya, This change has been integrated to master. Off to testing now...
          Hide
          rajeshtaneja Rajesh Taneja added a comment -

          Thanks for fixing this Yuliya,

          I can see error message for course badges, when cfg is disabled.

          Show
          rajeshtaneja Rajesh Taneja added a comment - Thanks for fixing this Yuliya, I can see error message for course badges, when cfg is disabled.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Just In Time® for stable releases, thanks!

          Closing as fixed, ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Just In Time® for stable releases, thanks! Closing as fixed, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/May/13