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

Loginas Not Triggering Enrolment Plugin

    Details

    • Type: Bug
    • Status: Closed
    • Priority: 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

          Attachments

            Activity

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

            Thanks for the report.

            Show
            skodak Petr Skoda added a comment - Thanks for the report.
            skodak Petr Skoda made changes -
            Field Original Value New Value
            Fix Version/s STABLE backlog [ 10463 ]
            Labels triaged
            skodak Petr Skoda made changes -
            Status Open [ 1 ] Development in progress [ 3 ]
            Hide
            skodak 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
            skodak 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!
            skodak 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
            samhemelryk Sam Hemelryk made changes -
            Currently in integration Yes [ 10041 ]
            samhemelryk Sam Hemelryk made changes -
            Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
            Integrator samhemelryk
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Petr - interesting one, has been integrated now.

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

            Great
            Passing the issue.
            Thanks

            Show
            ankit_frenz Ankit Agarwal added a comment - Great Passing the issue. Thanks
            ankit_frenz Ankit Agarwal made changes -
            Status Testing in progress [ 10011 ] Tested [ 10006 ]
            Hide
            poltawski 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
            poltawski 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!
            poltawski Dan Poltawski made changes -
            Status Tested [ 10006 ] Closed [ 6 ]
            Resolution Fixed [ 1 ]
            Currently in integration Yes [ 10041 ]
            Integration date 12/Apr/12
            Hide
            jschwanz Jason Schwanz added a comment -

            Excellent! Looking forward to 2.2.3.

            Show
            jschwanz 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:
                  Fix Release Date:
                  14/May/12