Commit 10fd21e6 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Disable editing of profile fields that are copied from Moodle


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 1d96f727
......@@ -84,6 +84,7 @@ foreach ( $element_list as $element => $type ) {
$items[$element] = array(
'type' => 'html',
'title' => get_string($element, 'artefact.internal'),
'value' => '--',
);
if (isset($profilefields[$element])) {
$items[$element]['value'] = clean_html($profilefields[$element]);
......@@ -445,7 +446,7 @@ $smarty->display('artefact:internal:index.tpl');
function locked_profile_fields() {
global $USER;
global $USER, $SESSION;
// Profile fields are locked for a user if they are locked by any
// institution the user is a member of, but not an admin for.
......@@ -453,11 +454,21 @@ function locked_profile_fields() {
$lockinginstitutions[] = 'mahara';
$lockinginstitutions = array_diff($lockinginstitutions, $USER->get('admininstitutions'));
return get_records_select_assoc(
$locked = get_records_select_assoc(
'institution_locked_profile_field',
'name IN (' . join(',', array_map('db_quote', $lockinginstitutions)) . ')',
null, '', 'profilefield,name'
);
if ($remotelocked = $SESSION->get('lockedfields')) {
foreach ($remotelocked as $f) {
if (!isset($locked[$f])) {
$locked[$f] = $f;
}
}
}
return $locked;
}
?>
......@@ -245,7 +245,8 @@ class AuthXmlrpc extends Auth {
}
}
$this->import_user_settings($user, $remoteuser);
$locked = $this->import_user_settings($user, $remoteuser);
$locked = array_merge($simplefieldstoimport, $locked);
$user->lastlastlogin = $user->lastlogin;
$user->lastlogin = time();
......@@ -354,6 +355,9 @@ class AuthXmlrpc extends Auth {
log_warn(get_string('cantcreatetempprofileiconfile', 'artefact.file', $filename));
}
}
if ($update) {
$locked[] = 'profileicon';
}
}
/*******************************************/
......@@ -369,6 +373,10 @@ class AuthXmlrpc extends Auth {
$SESSION->set('authinstance', $this->instanceid);
$SESSION->set('mnetuserfrom', $_SERVER['HTTP_REFERER']);
if ($update && isset($locked)) {
$SESSION->set('lockedfields', $locked);
}
return true;
}
......@@ -470,6 +478,8 @@ class AuthXmlrpc extends Auth {
$user->set_account_preference('wysiwyg', $htmleditor);
}
}
return array('town', 'country', 'introduction');
}
public function kill_parent($username) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment