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
    • Rank:
      39051

      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.

        Activity

        Hide
        Petr Škoda added a comment -

        Thanks for the report.

        Show
        Petr Škoda added a comment - Thanks for the report.
        Hide
        Petr Škoda 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 Škoda 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!
        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.
        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 Škoda 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 Škoda 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
        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!
        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: