Moodle
  1. Moodle
  2. MDL-32263

Loginas Not Triggering Enrolment Plugin

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.2.3
    • Component/s: Enrolments
    • Labels:
    • Testing Instructions:
      Hide

      For developers:

      1/ modify some enrol plugin to have login hook, such :
      public function sync_user_enrolments($user)

      { debugging('grrr'); die; }

      2/ login as admin and login ass, it should lead to debug message on white page

      Show
      For developers: 1/ modify some enrol plugin to have login hook, such : public function sync_user_enrolments($user) { debugging('grrr'); die; } 2/ login as admin and login ass, it should lead to debug message on white page
    • Affected Branches:
      MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w15_MDL-32263_m23_enroladmin

      Description

      I'm trying to test an enrolment plugin with 2.2.2, and the dynamic bit that runs on login is not being triggered when I use the Login As functionality. It is working in my 1.9 and 2.1 instances.

        Gliffy Diagrams

          Activity

          Jason Schwanz created issue -
          Hide
          Petr Skoda added a comment -

          Thanks for the report.

          Show
          Petr Skoda added a comment - Thanks for the report.
          Petr Skoda made changes -
          Field Original Value New Value
          Fix Version/s STABLE backlog [ 10463 ]
          Labels triaged
          Petr Skoda made changes -
          Status Open [ 1 ] Development in progress [ 3 ]
          Hide
          Petr Skoda added a comment -

          Oh, this was caused by my sloppy coding - I forgot to use $user in is_siteadmin() call which resulted in $USER being used instead - that means that instead of preventing this callback when logging admin in, it was preventing the callback when admin was already logged in.

          Adding back the admin restrictions might be viewed as a regression by some admins that abuse admin account for normal tasks, so I decided to remove this safety - if anything goes wrong in any enrol plugin the only way will be to disable the broken plugin via config.php override.

          Thanks a lot for the report!

          Show
          Petr Skoda added a comment - Oh, this was caused by my sloppy coding - I forgot to use $user in is_siteadmin() call which resulted in $USER being used instead - that means that instead of preventing this callback when logging admin in, it was preventing the callback when admin was already logged in. Adding back the admin restrictions might be viewed as a regression by some admins that abuse admin account for normal tasks, so I decided to remove this safety - if anything goes wrong in any enrol plugin the only way will be to disable the broken plugin via config.php override. Thanks a lot for the report!
          Petr Skoda made changes -
          Status Development in progress [ 3 ] Waiting for integration review [ 10010 ]
          Pull Master Diff URL https://github.com/skodak/moodle/compare/master...w15_MDL-32263_m23_enroladmin
          Pull Master Branch w15_MDL-32263_m23_enroladmin
          Pull from Repository git://github.com/skodak/moodle.git
          Fix Version/s 2.2.3 [ 12053 ]
          Fix Version/s 2.3 [ 10657 ]
          Fix Version/s STABLE backlog [ 10463 ]
          Testing Instructions For developers:

          1/ modify some enrol plugin to have login hook, such :
           public function sync_user_enrolments($user) {
               debugging('grrr');
               die;
           }

          2/ login as admin and login ass, it should lead to debug message on white page
          Pull 2.2 Diff URL https://github.com/skodak/moodle/compare/MOODLE_22_STABLE...w15_MDL-32263_m22_enroladmin
          Pull 2.2 Branch w15_MDL-32263_m22_enroladmin
          Sam Hemelryk made changes -
          Currently in integration Yes [ 10041 ]
          Sam Hemelryk made changes -
          Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
          Integrator samhemelryk
          Hide
          Sam Hemelryk added a comment -

          Thanks Petr - interesting one, has been integrated now.

          Show
          Sam Hemelryk added a comment - Thanks Petr - interesting one, has been integrated now.
          Sam Hemelryk made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          Fix Version/s 2.3 [ 10657 ]
          Michael de Raadt made changes -
          Tester ankit_frenz
          Ankit Agarwal made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          Hide
          Ankit Agarwal added a comment -

          This works fine when am trying to login or using login as to login as another user.

          But the debugging is not triggered when am using "login as guest"

          Is that is expected output?

          Thanks

          Show
          Ankit Agarwal added a comment - This works fine when am trying to login or using login as to login as another user. But the debugging is not triggered when am using "login as guest" Is that is expected output? Thanks
          Hide
          Petr Skoda added a comment -

          guest login is not related to "login-as real user" feature, in any case the guest account can not be enrolled in any course, so yes it should be expected output

          Show
          Petr Skoda added a comment - guest login is not related to "login-as real user" feature, in any case the guest account can not be enrolled in any course, so yes it should be expected output
          Hide
          Ankit Agarwal added a comment -

          Great
          Passing the issue.
          Thanks

          Show
          Ankit Agarwal added a comment - Great Passing the issue. Thanks
          Ankit Agarwal made changes -
          Status Testing in progress [ 10011 ] Tested [ 10006 ]
          Hide
          Dan Poltawski added a comment -

          Jolly good show!

          Your changes have made it into the Moodle release - its time to celebrate! I suggest a hot cup of English tea (with milk, no sugar) or a hoppy English ale.

          Tally-ho!

          Show
          Dan Poltawski added a comment - Jolly good show! Your changes have made it into the Moodle release - its time to celebrate! I suggest a hot cup of English tea (with milk, no sugar) or a hoppy English ale. Tally-ho!
          Dan Poltawski made changes -
          Status Tested [ 10006 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Currently in integration Yes [ 10041 ]
          Integration date 12/Apr/12
          Hide
          Jason Schwanz added a comment -

          Excellent! Looking forward to 2.2.3.

          Show
          Jason Schwanz added a comment - Excellent! Looking forward to 2.2.3.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: