From 222b01f5169f1c7e69762e0e8904c24f78f71882 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 28 Jul 2010 11:52:48 +0200 Subject: update to MediaWiki 1.16.0 --- includes/extauth/Hardcoded.php | 79 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 includes/extauth/Hardcoded.php (limited to 'includes/extauth/Hardcoded.php') diff --git a/includes/extauth/Hardcoded.php b/includes/extauth/Hardcoded.php new file mode 100644 index 00000000..a9a60bea --- /dev/null +++ b/includes/extauth/Hardcoded.php @@ -0,0 +1,79 @@ + array( + * 'password' => 'literal string', + * 'emailaddress' => 'bob@example.com', + * ), + * ); + * + * Multiple names may be provided. The keys of the inner arrays can be either + * 'password', or the name of any preference. + * + * @ingroup ExternalUser + */ +class ExternalUser_Hardcoded extends ExternalUser { + private $mName; + + protected function initFromName( $name ) { + global $wgExternalAuthConf; + + if ( isset( $wgExternalAuthConf[$name] ) ) { + $this->mName = $name; + return true; + } + return false; + } + + protected function initFromId( $id ) { + return $this->initFromName( $id ); + } + + public function getId() { + return $this->mName; + } + + public function getName() { + return $this->mName; + } + + public function authenticate( $password ) { + global $wgExternalAuthConf; + + return isset( $wgExternalAuthConf[$this->mName]['password'] ) + && $wgExternalAuthConf[$this->mName]['password'] == $password; + } + + public function getPref( $pref ) { + global $wgExternalAuthConf; + + if ( isset( $wgExternalAuthConf[$this->mName][$pref] ) ) { + return $wgExternalAuthConf[$this->mName][$pref]; + } + return null; + } + + # TODO: Implement setPref() via regex on LocalSettings. (Just kidding.) +} -- cgit v1.2.2