Status, Roles and additional settings destroyed after configuring LDAP UI Options
| Project: | LDAP integration |
| Version: | 5.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | disable email, disable password, fieldset, ldap, profile, roles, status |
Jump to:
When both Remove password change fields from user edit form and Alter email field on user edit form on the LDAP UI Options page are set the Account settings fieldset on the profile page is destroyed by the ldapauth_form_alter() function. This causes problems for users having permission administer users since settings they should be able to edit is removed.
How to reproduce the bug:
1) In /admin/settings/ldapauth/options expand "LDAP UI Options". Check Remove password change fields from user edit form and select one of the options available for Alter email field on user edit form.
2) Save configuration.
3) Log in with a user having permission administer users and edit another users profile data. A user with administer users permission should be able to edit both Status and Roles settings for a user. The fieldset Account settings and the additional fields such as Status and Roles are not shown as expected.
I suggest that the whole code block below should be removed from the ldapauth_form_alter() function. To me it makes no sense to remove the whole Account settings fieldset just because it will only contain the email field for normal users.
<?php
// Remove fieldset if empty
if (key_exists('account', $form) && !key_exists('pass', $form['account']) && key_exists('mail', $form['account'])
&& $form['account']['mail']['#type'] == 'hidden') {
// First make sure no one else added any unexpected form fields
foreach ($form['account'] as $key => $value) {
if ((substr($key, 0, 1) <> '#') && !($key == 'mail' || $key == 'pass')) {
// A key that isn't an attribute, 'mail', or 'pass' found; break to avoid removing fieldset
break;
}
}
// No other fields, preserve mail and nuke fieldset
$form['mail'] = $form['account']['mail'];
unset($form['account']);
}
?>
#1
As a result of this the email field is set to NULL when saved. A user updating their own profile, or if a user with administer users permission updates another user it will therefore set the email address to NULL.