-
Bug
-
Resolution: Fixed
-
Major
-
2.4, 2.6, 2.7
-
MOODLE_24_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_27_STABLE, MOODLE_28_STABLE
-
MDL-37704-master -
In authentication plugins, even if Description is mark as Locked, it is still unlock and editable in the user profile.
To reproduce :
- Go in Home
/ ► Site administration
/ ► Plugins
/ ► Authentication
/ ► Manual accounts - Set Description to "Locked"
- Log in with a student account
- Go to Settings/Edit my account
- Try to edit Description field and save
- Modifications are indeed saved but they shouldn't
I track this down to \user\edit_form.php, line #100 to #120 :
$fields = get_user_fieldnames();
|
$authplugin = get_auth_plugin($user->auth);
|
foreach ($fields as $field) {
|
if (!$mform->elementExists($field)) {
|
continue;
|
}
|
$configvariable = 'field_lock_' . $field;
|
if (isset($authplugin->config->{$configvariable})) {
|
if ($authplugin->config->{$configvariable} === 'locked') {
|
$mform->hardFreeze($field);
|
$mform->setConstant($field, $user->$field);
|
} else if ($authplugin->config->{$configvariable} === 'unlockedifempty' and $user->$field != '') {
|
$mform->hardFreeze($field);
|
$mform->setConstant($field, $user->$field);
|
}
|
}
|
}
|
The problem is with
$mform->elementExists($field)
|