LDAP-authentification doesn't work in 1.7...

LDAP-authentification doesn't work in 1.7...

ໂດຍ Maik Riecken -
ຈຳນວນການຕອບກັບ: 6
When I'm trying to use LDAP-authentification with moodle 1.7, I get:

"This SQL relies on obsolete tables! Your code must be fixed by a developer."

after trying to log in an LDAP-User. Is this a tribute to beta-status and is it going to be fixed? LDAP is great...

regards,

Maik
ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Maik Riecken

Re: LDAP-authentification doesn't work in 1.7...

ໂດຍ Dan Marsden -
ຮູບພາບຂອງ Core developers ຮູບພາບຂອງ Particularly helpful Moodlers ຮູບພາບຂອງ Peer reviewers ຮູບພາບຂອງ Plugin developers ຮູບພາບຂອງ Plugins guardians ຮູບພາບຂອງ Testers ຮູບພາບຂອງ Translators
patch is already in CVS. - LDAP works, just the course creator has an issue.

see MDL-6928

ຍິ້ມ

Dan

ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Dan Marsden

Re: LDAP-authentification doesn't work in 1.7...

ໂດຍ Maik Riecken -
Thanks. After deleting course creators everything is fine again.

Maik
ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Maik Riecken

Re: LDAP-authentification doesn't work in 1.7...

ໂດຍ Gisela Hillenbrand -
ຮູບພາບຂອງ Documentation writers
Hi Maik,

what do you mean with "after deleting course creators everything works fine"?

We are using LDAP authentification but course creators are not identified correctly. Looking at the LDAP Server log file does not give an error.

Gisela
ການຈັດອັນດັບສະເລ່ຍ: -
ໃນການຕອບກັບຫາ Dan Marsden

Re: LDAP-authentification doesn't work in 1.7...

ໂດຍ Gisela Hillenbrand -
ຮູບພາບຂອງ Documentation writers
It seem's to me that the code at line 2385 - ... in moodlelib.php is still not correct.

The original code is:

if (function_exists('auth_iscreator')) {
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
if ($creatorroles = get_roles_with_capability('moodle/legacy:coursecreator', CAP_ALLOW)) {
$creatorrole = array_shift($creatorroles); // We can only use one, let's use the first one
// Check if the user is a creator
if (auth_iscreator($username)) { // Following calls will not create duplicates
if ($useriscreator) {
role_assign($creatorrole->id, $user->id, 0, $sitecontext->id, 0, 0, 0, 'ldap');
} else {
role_unassign($creatorrole->id, $user->id, 0, $sitecontext->id);
}
}
}
}

However, the variable $useriscreator is not defined.

If I change the code to the following LDAP authentification and course creators work fine:

if (function_exists('auth_iscreator')) {
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
if ($creatorroles = get_roles_with_capability('moodle/legacy:coursecreator', CAP_ALLOW)) {
$creatorrole = array_shift($creatorroles); // We can only use one, let's use the first one
// Check if the user is a creator
$useriscreator = auth_iscreator($username); // Following calls will not create duplicates
if ($useriscreator) {
role_assign($creatorrole->id, $user->id, 0, $sitecontext->id, 0, 0, 0, 'ldap');
} else {
role_unassign($creatorrole->id, $user->id, 0, $sitecontext->id);
}
}
}

Sorry, I don't get the code formatted in a better readable way ເສົ້າ

Gisela

ການຈັດອັນດັບສະເລ່ຍ:Useful (1)
ໃນການຕອບກັບຫາ Gisela Hillenbrand

Re: LDAP-authentification doesn't work in 1.7...

ໂດຍ Yu Zhang -
Hi Gisela,

Thanks very much for spotting it, and thanks very much for posting the patch, the right code is in CVS now. And thanks Dan for pointing me here =0

Cheers,

Yu
ການຈັດອັນດັບສະເລ່ຍ: -