MDL-27675 mod_feedback: Tidy up of phpdocs and scope within feedback mod
[moodle.git] / auth / none / auth.php
blobf0771d8f58308eaef3df8744a0f7d10302be2330
1 <?php
3 /**
4 * @author Martin Dougiamas
5 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
6 * @package moodle multiauth
8 * Authentication Plugin: No Authentication
10 * No authentication at all. This method approves everything!
12 * 2006-08-31 File created.
15 if (!defined('MOODLE_INTERNAL')) {
16 die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
19 require_once($CFG->libdir.'/authlib.php');
21 /**
22 * Plugin for no authentication.
24 class auth_plugin_none extends auth_plugin_base {
26 /**
27 * Constructor.
29 function auth_plugin_none() {
30 $this->authtype = 'none';
31 $this->config = get_config('auth/none');
34 /**
35 * Returns true if the username and password work or don't exist and false
36 * if the user exists and the password is wrong.
38 * @param string $username The username
39 * @param string $password The password
40 * @return bool Authentication success or failure.
42 function user_login ($username, $password) {
43 global $CFG, $DB;
44 if ($user = $DB->get_record('user', array('username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
45 return validate_internal_user_password($user, $password);
47 return true;
50 /**
51 * Updates the user's password.
53 * called when the user password is updated.
55 * @param object $user User table object
56 * @param string $newpassword Plaintext password
57 * @return boolean result
60 function user_update_password($user, $newpassword) {
61 $user = get_complete_user_data('id', $user->id);
62 return update_internal_user_password($user, $newpassword);
65 function prevent_local_passwords() {
66 return false;
69 /**
70 * Returns true if this authentication plugin is 'internal'.
72 * @return bool
74 function is_internal() {
75 return true;
78 /**
79 * Returns true if this authentication plugin can change the user's
80 * password.
82 * @return bool
84 function can_change_password() {
85 return true;
88 /**
89 * Returns the URL for changing the user's pw, or empty if the default can
90 * be used.
92 * @return moodle_url
94 function change_password_url() {
95 return null;
98 /**
99 * Returns true if plugin allows resetting of internal password.
101 * @return bool
103 function can_reset_password() {
104 return true;
108 * Prints a form for configuring this authentication plugin.
110 * This function is called from admin/auth.php, and outputs a full page with
111 * a form for configuring this plugin.
113 * @param array $page An object containing all the data for this page.
115 function config_form($config, $err, $user_fields) {
116 include "config.html";
120 * Processes and stores configuration data for this authentication plugin.
122 function process_config($config) {
123 return true;