/**
* @author Martin Dougiamas
* @author Jerome GUTIERREZ
- * @author Iñaki Arenaza
+ * @author I�aki Arenaza
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package moodle multiauth
*
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
- * @return string
+ * @return moodle_url
*/
function change_password_url() {
- return '';
+ return null;
}
/**
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
- * @return string
+ * @return moodle_url
*/
function change_password_url() {
if ($this->config->passtype == 'internal') {
// standard form
- return '';
+ return null;
} else {
// use custom url
- return $this->config->changepasswordurl;
+ return new moodle_url($this->config->changepasswordurl);
}
}
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
- * @return mixed
+ * @return moodle_url
*/
function change_password_url() {
- return ''; // use dafult internal method
+ return null; // use default internal method
}
/**
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
- * @return string
+ * @return moodle_url
*/
function change_password_url() {
- return $this->config->changepasswordurl;
+ return new moodle_url($this->config->changepasswordurl);
}
/**
/**
* @author Martin Dougiamas
- * @author Iñaki Arenaza
+ * @author I�aki Arenaza
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package moodle multiauth
*
if (empty($user_entry)) {
$attribs = join (', ', $search_attribs);
error_log($this->errorlogtag.get_string('updateusernotfound', 'auth_ldap',
- array('userdn'=>$user_dn,
+ array('userdn'=>$user_dn,
'attribs'=>$attribs)));
return false; // old user not found!
} else if (count($user_entry) > 1) {
* Returns the URL for changing the user's password, or empty if the default can
* be used.
*
- * @return string url
+ * @return moodle_url
*/
function change_password_url() {
if (empty($this->config->stdchangepassword)) {
- return $this->config->changepasswordurl;
+ return new moodle_url($this->config->changepasswordurl);
} else {
- return '';
+ return null;
}
}
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
- * @return string
+ * @return moodle_url
*/
function change_password_url() {
- return '';
+ return null;
}
/**
* Returns the URL for changing the user's pw, or false if the default can
* be used.
*
- * @return string
+ * @return moodle_url
*/
function change_password_url() {
- return '';
+ return null;
}
/**
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
- * @return string
+ * @return moodle_url
*/
function change_password_url() {
- return '';
+ return null;
}
/**
* Returns the URL for changing the user's pw, or false if the default can
* be used.
*
- * @return bool
+ * @return moodle_url
*/
function change_password_url() {
- return $this->config->changepasswordurl;
+ return new moodle_url($this->config->changepasswordurl);
}
/**
* Returns the URL for changing the user's pw, or empty if the default can
* be used.
*
- * @return string
+ * @return moodle_url
*/
function change_password_url() {
- return '';
+ return null;
}
/**
$string['md5'] = 'MD5 hash';
$string['nopasswordchange'] = 'Password can not be changed';
$string['nopasswordchangeforced'] = 'You cannot proceed without changing your password, however there is no available page for changing it. Please contact your Moodle Administrator.';
+$string['noprofileedit'] = 'Profile can not be edited';
$string['ntlmsso_attempting'] = 'Attempting Single Sign On via NTLM...';
$string['ntlmsso_failed'] = 'Auto-login failed, try the normal login page...';
$string['ntlmsso_isdisabled'] = 'NTLM SSO is disabled.';
* This method is used if can_change_password() returns true.
* This method is called only when user is logged in, it may use global $USER.
*
- * @return string
+ * @return moodle_url url of the profile page or null if standard used
*/
function change_password_url() {
//override if needed
- return '';
+ return null;
+ }
+
+ /**
+ * Returns true if this authentication plugin can edit the users'
+ * profile.
+ *
+ * @return bool
+ */
+ function can_edit_profile() {
+ //override if needed
+ return true;
+ }
+
+ /**
+ * Returns the URL for editing the users' profile, or empty if the default
+ * URL can be used.
+ *
+ * This method is used if can_edit_profile() returns true.
+ * This method is called only when user is logged in, it may use global $USER.
+ *
+ * @return moodle_url url of the profile page or null if standard used
+ */
+ function edit_profile_url() {
+ //override if needed
+ return null;
}
/**
$url = new moodle_url('/user/editadvanced.php', array('id'=>$user->id, 'course'=>$course->id));
$usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
} else if ((has_capability('moodle/user:editprofile', $usercontext) && !is_siteadmin($user)) || ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext))) {
- $url = new moodle_url('/user/edit.php', array('id'=>$user->id, 'course'=>$course->id));
- $usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
+ if (!empty($user->auth)) {
+ $userauth = get_auth_plugin($user->auth);
+ if ($userauth->can_edit_profile()) {
+ $url = $userauth->edit_profile_url();
+ if (empty($url)) {
+ $url = new moodle_url('/user/edit.php', array('id'=>$user->id, 'course'=>$course->id));
+ }
+ $usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
+ }
+ }
}
}
if (!empty($userauth->config->expiration) and $userauth->config->expiration == 1) {
if ($userauth->can_change_password()) {
$passwordchangeurl = $userauth->change_password_url();
- if(!$passwordchangeurl) {
+ if (!$passwordchangeurl) {
$passwordchangeurl = $CFG->httpswwwroot.'/login/change_password.php';
}
} else {
redirect($CFG->wwwroot . "/user/view.php?course={$course->id}");
}
+// load the appropriate auth plugin
+$userauth = get_auth_plugin($user->auth);
+
+if (!$userauth->can_edit_profile()) {
+ print_error('noprofileedit', 'auth');
+}
+
+if ($editurl = $userauth->edit_profile_url()) {
+ // this internal script not used
+ redirect($editurl);
+}
+
if ($course->id == SITEID) {
$coursecontext = get_context_instance(CONTEXT_SYSTEM); // SYSTEM context
} else {