MediaWiki
REL1_19
|
00001 <?php 00042 class ExternalUser_Hardcoded extends ExternalUser { 00043 private $mName; 00044 00045 protected function initFromName( $name ) { 00046 global $wgExternalAuthConf; 00047 00048 if ( isset( $wgExternalAuthConf[$name] ) ) { 00049 $this->mName = $name; 00050 return true; 00051 } 00052 return false; 00053 } 00054 00055 protected function initFromId( $id ) { 00056 return $this->initFromName( $id ); 00057 } 00058 00059 public function getId() { 00060 return $this->mName; 00061 } 00062 00063 public function getName() { 00064 return $this->mName; 00065 } 00066 00067 public function authenticate( $password ) { 00068 global $wgExternalAuthConf; 00069 00070 return isset( $wgExternalAuthConf[$this->mName]['password'] ) 00071 && $wgExternalAuthConf[$this->mName]['password'] == $password; 00072 } 00073 00074 public function getPref( $pref ) { 00075 global $wgExternalAuthConf; 00076 00077 if ( isset( $wgExternalAuthConf[$this->mName][$pref] ) ) { 00078 return $wgExternalAuthConf[$this->mName][$pref]; 00079 } 00080 return null; 00081 } 00082 00083 # TODO: Implement setPref() via regex on LocalSettings. (Just kidding.) 00084 }