MDL-53580 auth_ldap: Set default value for suspended_attribute

It was also necessary to cast some boolean values to ints as a
workaround for moodle's broken boolean validation.
This commit is contained in:
Cameron Ball
2016-05-10 23:04:46 +08:00
parent e4b5a062d8
commit 8ffe9aef1f
2 changed files with 13 additions and 2 deletions
+5 -2
View File
@@ -937,7 +937,9 @@ class auth_plugin_ldap extends auth_plugin_base {
// It isn't possible to just rely on the configured suspension attribute since
// things like active directory use bit masks, other things using LDAP might
// do different stuff as well.
$user->suspended = $this->is_user_suspended($user);
//
// The cast to int is a workaround for MDL-53959.
$user->suspended = (int)$this->is_user_suspended($user);
if (empty($user->lang)) {
$user->lang = $CFG->lang;
}
@@ -1012,7 +1014,8 @@ class auth_plugin_ldap extends auth_plugin_base {
if (!empty($updatekeys)) {
$newuser = new stdClass();
$newuser->id = $userid;
$newuser->suspended = $this->is_user_suspended((object) $newinfo);
// The cast to int is a workaround for MDL-53959.
$newuser->suspended = (int)$this->is_user_suspended((object) $newinfo);
foreach ($updatekeys as $key) {
if (isset($newinfo[$key])) {
+8
View File
@@ -75,6 +75,14 @@ function ldap_getdefaults() {
'ad' => 'cn',
'default' => 'cn'
);
$default['suspended_attribute'] = array(
'edir' => '',
'rfc2307' => '',
'rfc2307bis' => '',
'samba' => '',
'ad' => '',
'default' => ''
);
$default['memberattribute'] = array(
'edir' => 'member',
'rfc2307' => 'member',