|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00028 if (!defined('MOODLE_INTERNAL')) { 00029 die('Direct access to this script is forbidden.'); 00030 } 00031 00032 require_once($CFG->libdir.'/authlib.php'); 00033 00037 class auth_plugin_webservice extends auth_plugin_base { 00038 00042 function auth_plugin_webservice() { 00043 $this->authtype = 'webservice'; 00044 $this->config = get_config('auth/webservice'); 00045 } 00046 00056 function user_login($username, $password) { 00057 // normla logins not allowed! 00058 return false; 00059 } 00060 00067 function user_login_webservice($username, $password) { 00068 global $CFG, $DB; 00069 // special web service login 00070 if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) { 00071 return validate_internal_user_password($user, $password); 00072 } 00073 return false; 00074 } 00075 00086 function user_update_password($user, $newpassword) { 00087 $user = get_complete_user_data('id', $user->id); 00088 return update_internal_user_password($user, $newpassword); 00089 } 00090 00096 function is_internal() { 00097 return true; 00098 } 00099 00106 function can_change_password() { 00107 return false; 00108 } 00109 00116 function change_password_url() { 00117 return null; 00118 } 00119 00125 function can_reset_password() { 00126 return false; 00127 } 00128 00137 function config_form($config, $err, $user_fields) { 00138 } 00139 00143 function process_config($config) { 00144 return true; 00145 } 00146 00152 function user_confirm($username, $confirmsecret = null) { 00153 return AUTH_CONFIRM_ERROR; 00154 } 00155 00156 }