Skip to content

Commit

Permalink
MDL-53580 auth_ldap: Set default value for suspended_attribute
Browse files Browse the repository at this point in the history
It was also necessary to cast some boolean values to ints as a
workaround for moodle's broken boolean validation.
  • Loading branch information
cameron1729 committed May 10, 2016
1 parent e4b5a06 commit 8ffe9ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions auth/ldap/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,9 @@ function sync_users($do_updates=true) {
// 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;
}
Expand Down Expand Up @@ -1012,7 +1014,8 @@ function update_user_record($username, $updatekeys = false, $triggerevent = fals
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])) {
Expand Down
8 changes: 8 additions & 0 deletions lib/ldaplib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit 8ffe9ae

Please sign in to comment.