Moodle

mnet_log records incorrect user ID

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9.4
  • Fix Version/s: 1.9.5
  • Component/s: MNet
  • Labels:
    None
  • Difficulty:
    Easy
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

Line 880 of auth/mnet/auth.php reads:
$logEntryObj->userid = get_field('user','id','username',$logEntryObj->username);
However, this ignores the mnethostid field, and so may fetch the incorrect user ID. The line should instead read something like:
$logEntryObj->userid = get_field('user','id','username',$logEntryObj->username,'mnethostid',(int)$MNET_REMOTE_CLIENT->id);

Activity

Hide
Zachary Hoffman added a comment -

Made the patch as described.

Show
Zachary Hoffman added a comment - Made the patch as described.
Hide
Petr Škoda (skodak) added a comment -

fixed, thanks a lot both of you!

Show
Petr Škoda (skodak) added a comment - fixed, thanks a lot both of you!
Hide
Eloy Lafuente (stronk7) added a comment -

Tested. Works!

Although those globals like $MNET_REMOTE_CLIENT... grrr! Some day all that stuff will need to be encapsulated in some way.

Thanks!

Show
Eloy Lafuente (stronk7) added a comment - Tested. Works! Although those globals like $MNET_REMOTE_CLIENT... grrr! Some day all that stuff will need to be encapsulated in some way. Thanks!

Dates

  • Created:
    Updated:
    Resolved: