Moodle

auth sync_users does not reactivate suspended users

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 2.0
  • Component/s: Authentication
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

When using the auth_db_sync_users the suspended users does not get active again.

Issue Links

Activity

Hide
Seiti Yamashiro added a comment -

Solved including this code in moodle/auth/db/auth.php, at line 379:

// and maybe the user was suspended instead of deleted
} elseif ($old_user = get_record('user', 'username', $user->username, 'auth', 'nologin', 'mnethostid', $user->mnethostid)) {
$user->id = $old_user->id;
if (!set_field('user', 'auth', 'db', 'username', $user->username)){ echo "\t"; print_string('auth_dbrevivedusererror', 'auth', array(stripslashes($user->username), $user->id)); echo "\n"; }else{ echo "\t"; print_string('auth_dbreviveduser', 'auth', array(stripslashes($user->username), $user->id)); echo "\n"; }

Maybe it wasn´t the best way to correct this, but it does the job. =)

cya!
Seiti

Note to myself: install diff tools on my mindows env.

Show
Seiti Yamashiro added a comment - Solved including this code in moodle/auth/db/auth.php, at line 379: // and maybe the user was suspended instead of deleted } elseif ($old_user = get_record('user', 'username', $user->username, 'auth', 'nologin', 'mnethostid', $user->mnethostid)) { $user->id = $old_user->id; if (!set_field('user', 'auth', 'db', 'username', $user->username)){ echo "\t"; print_string('auth_dbrevivedusererror', 'auth', array(stripslashes($user->username), $user->id)); echo "\n"; }else{ echo "\t"; print_string('auth_dbreviveduser', 'auth', array(stripslashes($user->username), $user->id)); echo "\n"; } Maybe it wasn´t the best way to correct this, but it does the job. =) cya! Seiti Note to myself: install diff tools on my mindows env.
Hide
Petr Škoda (skodak) added a comment -

I am looking at the problem now, thanks!

Show
Petr Škoda (skodak) added a comment - I am looking at the problem now, thanks!
Hide
Petr Škoda (skodak) added a comment -

Thinking more about this, the current implementation was intentional, you can disable login for user that is present in external database, by manually changing his/her auth field. I agree that this might not be always wanted, it should be IMO solved by a new configuration switch. Setting target as 1.9, because we are not allowed major changes in STABLE branch.

Thanks for the report, I hope ppl that need this will find this report

Show
Petr Škoda (skodak) added a comment - Thinking more about this, the current implementation was intentional, you can disable login for user that is present in external database, by manually changing his/her auth field. I agree that this might not be always wanted, it should be IMO solved by a new configuration switch. Setting target as 1.9, because we are not allowed major changes in STABLE branch. Thanks for the report, I hope ppl that need this will find this report
Hide
Seiti Yamashiro added a comment -

It's just that we have the "suspend users" option, but no "unsuspend/activate" on auth_db.
I agree that a configuration switch would be great!

thanks for the fast response,
Seiti

Show
Seiti Yamashiro added a comment - It's just that we have the "suspend users" option, but no "unsuspend/activate" on auth_db. I agree that a configuration switch would be great! thanks for the fast response, Seiti
Hide
Sergi Garcia Besora added a comment -

Hello Seti and Petr. I've installed 1.9.9 in a education center and still have de same problem Setti posted some years ago.
I've modified de code with de Seti piece of code.

I've searched the Moodle tracker for a new post about the same problem for a new version of Moodle but I've been unable to find any.

What do you recomend. Is this functionality missing ? For me the solution that Seti post is the one that solves de bug.

Thank you for your help.
Sergi

Show
Sergi Garcia Besora added a comment - Hello Seti and Petr. I've installed 1.9.9 in a education center and still have de same problem Setti posted some years ago. I've modified de code with de Seti piece of code. I've searched the Moodle tracker for a new post about the same problem for a new version of Moodle but I've been unable to find any. What do you recomend. Is this functionality missing ? For me the solution that Seti post is the one that solves de bug. Thank you for your help. Sergi
Hide
Petr Škoda (skodak) added a comment -

This should be finally fixed in 2.0dev, no changes are planned in 1.9.x because they changes are too big for stable branch, sorry.
Thanks for the report.

Petr Skoda

Show
Petr Škoda (skodak) added a comment - This should be finally fixed in 2.0dev, no changes are planned in 1.9.x because they changes are too big for stable branch, sorry. Thanks for the report. Petr Skoda
Hide
Sergi Garcia Besora added a comment -

Thank you Petr for your quick answer.

Sergi

Show
Sergi Garcia Besora added a comment - Thank you Petr for your quick answer. Sergi
Hide
Chris Brainerd added a comment -

Hi, I'm running 2.0.3 and this is not fixed. Why is this marked as fixed for 2.0 and can I vote for some attention to this issue? This is a critical function for our Moodle. Thanks

Show
Chris Brainerd added a comment - Hi, I'm running 2.0.3 and this is not fixed. Why is this marked as fixed for 2.0 and can I vote for some attention to this issue? This is a critical function for our Moodle. Thanks

People

Dates

  • Created:
    Updated:
    Resolved: