mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 04:33:13 +01:00
MDL-50925 auth_pam: Remove from core and into plugins DB
This commit is contained in:
parent
db6ba96510
commit
f9d12a2d1e
@ -1,123 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Authentication Plugin: PAM Authentication
|
||||
*
|
||||
* PAM (Pluggable Authentication Modules) for Moodle
|
||||
*
|
||||
* Description:
|
||||
* Authentication by using the PHP4 PAM module:
|
||||
* http://www.math.ohio-state.edu/~ccunning/pam_auth/
|
||||
*
|
||||
* Version 0.3 2006/09/07 by Jonathan Harker (plugin class)
|
||||
* Version 0.2: 2004/09/01 by Martin V<EFBFBD>geli (stable version)
|
||||
* Version 0.1: 2004/08/30 by Martin V<EFBFBD>geli (first draft)
|
||||
*
|
||||
* Contact: martinvoegeli@gmx.ch
|
||||
* Website 1: http://elearning.zhwin.ch/
|
||||
* Website 2: http://birdy1976.com/
|
||||
*
|
||||
* @package auth_pam
|
||||
* @author Martin Dougiamas
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir.'/authlib.php');
|
||||
|
||||
/**
|
||||
* PAM authentication plugin.
|
||||
*/
|
||||
class auth_plugin_pam extends auth_plugin_base {
|
||||
|
||||
/**
|
||||
* Store error messages from pam authentication attempts.
|
||||
*/
|
||||
var $lasterror;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->authtype = 'pam';
|
||||
$this->config = get_config('auth_pam');
|
||||
$this->errormessage = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Old syntax of class constructor. Deprecated in PHP7.
|
||||
*
|
||||
* @deprecated since Moodle 3.1
|
||||
*/
|
||||
public function auth_plugin_pam() {
|
||||
debugging('Use of class name as constructor is deprecated', DEBUG_DEVELOPER);
|
||||
self::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the username and password work and false if they are
|
||||
* wrong or don't exist.
|
||||
*
|
||||
* @param string $username The username
|
||||
* @param string $password The password
|
||||
* @return bool Authentication success or failure.
|
||||
*/
|
||||
function user_login ($username, $password) {
|
||||
// variable to store possible errors during authentication
|
||||
$errormessage = str_repeat(' ', 2048);
|
||||
|
||||
// just for testing and debugging
|
||||
// error_reporting(E_ALL);
|
||||
|
||||
// call_time_pass_reference of errormessage is deprecated - throws warnings in multiauth
|
||||
//if (pam_auth($username, $password, &$errormessage)) {
|
||||
if (pam_auth($username, $password)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
$this->lasterror = $errormessage;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function prevent_local_passwords() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin is 'internal'.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function is_internal() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this authentication plugin can change the user's
|
||||
* password.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function can_change_password() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
<?php
|
||||
|
||||
function xmldb_auth_pam_install() {
|
||||
global $CFG, $DB;
|
||||
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* PAM authentication plugin upgrade code
|
||||
*
|
||||
* @package auth_pam
|
||||
* @copyright 2017 Stephen Bourget
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/**
|
||||
* Function to upgrade auth_pam.
|
||||
* @param int $oldversion the version we are upgrading from
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_pam_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Automatically generated Moodle v3.2.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2017020700) {
|
||||
// Convert info in config plugins from auth/pam to auth_pam.
|
||||
upgrade_fix_config_auth_plugin_names('pam');
|
||||
upgrade_fix_config_auth_plugin_defaults('pam');
|
||||
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'pam');
|
||||
}
|
||||
|
||||
// Automatically generated Moodle v3.3.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'auth_pam', language 'en'.
|
||||
*
|
||||
* @package auth_pam
|
||||
* @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['auth_pamdescription'] = 'This method uses PAM to access the native usernames on this server. You have to install <a href="http://www.math.ohio-state.edu/~ccunning/pam_auth/">PHP4 PAM Authentication</a> in order to use this module.';
|
||||
$string['auth_passwordisexpired'] = 'Your password has expired. Do you want to change your password now?';
|
||||
$string['auth_passwordwillexpire'] = 'Your password will expire in {$a} days. Do you want to change your password now?';
|
||||
$string['pluginname'] = 'PAM (Pluggable Authentication Modules)';
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Admin settings and defaults.
|
||||
*
|
||||
* @package auth_pam
|
||||
* @copyright 2017 Stephen Bourget
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
if ($ADMIN->fulltree) {
|
||||
|
||||
// Introductory explanation.
|
||||
$settings->add(new admin_setting_heading('auth_pam/pluginname', '',
|
||||
new lang_string('auth_pamdescription', 'auth_pam')));
|
||||
|
||||
// Display locking / mapping of profile fields.
|
||||
$authplugin = get_auth_plugin('pam');
|
||||
display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
|
||||
get_string('auth_fieldlocks_help', 'auth'), false, false);
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
This files describes API changes in /auth/pam/*,
|
||||
information provided here is intended especially for developers.
|
||||
|
||||
=== 3.3 ===
|
||||
|
||||
* The config.html file was migrated to use the admin settings API.
|
||||
The identifier for configuration data stored in config_plugins table was converted from 'auth/pam' to 'auth_pam'.
|
@ -1,29 +0,0 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Version information
|
||||
*
|
||||
* @package auth_pam
|
||||
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2017050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_pam'; // Full name of the plugin (used for diagnostics)
|
@ -1646,7 +1646,7 @@ class core_plugin_manager {
|
||||
// Moodle 2.3 supports upgrades from 2.2.x only.
|
||||
$plugins = array(
|
||||
'qformat' => array('blackboard', 'learnwise'),
|
||||
'auth' => array('radius', 'fc', 'nntp'),
|
||||
'auth' => array('radius', 'fc', 'nntp', 'pam'),
|
||||
'block' => array('course_overview'),
|
||||
'enrol' => array('authorize'),
|
||||
'report' => array('search'),
|
||||
@ -1702,7 +1702,7 @@ class core_plugin_manager {
|
||||
|
||||
'auth' => array(
|
||||
'cas', 'db', 'email', 'imap', 'ldap', 'lti', 'manual', 'mnet',
|
||||
'nologin', 'none', 'oauth2', 'pam', 'pop3', 'shibboleth', 'webservice'
|
||||
'nologin', 'none', 'oauth2', 'pop3', 'shibboleth', 'webservice'
|
||||
),
|
||||
|
||||
'availability' => array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user