MediaWiki
REL1_19
|
00001 <?php 00036 class AuthPlugin { 00046 public function userExists( $username ) { 00047 # Override this! 00048 return false; 00049 } 00050 00061 public function authenticate( $username, $password ) { 00062 # Override this! 00063 return false; 00064 } 00065 00072 public function modifyUITemplate( &$template, &$type ) { 00073 # Override this! 00074 $template->set( 'usedomain', false ); 00075 } 00076 00082 public function setDomain( $domain ) { 00083 $this->domain = $domain; 00084 } 00085 00092 public function validDomain( $domain ) { 00093 # Override this! 00094 return true; 00095 } 00096 00107 public function updateUser( &$user ) { 00108 # Override this and do something 00109 return true; 00110 } 00111 00125 public function autoCreate() { 00126 return false; 00127 } 00128 00138 public function allowPropChange( $prop = '' ) { 00139 if ( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) { 00140 return $this->allowRealNameChange(); 00141 } elseif ( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) { 00142 return $this->allowEmailChange(); 00143 } elseif ( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) { 00144 return $this->allowNickChange(); 00145 } else { 00146 return true; 00147 } 00148 } 00149 00155 public function allowPasswordChange() { 00156 return true; 00157 } 00158 00164 public function allowSetLocalPassword() { 00165 return true; 00166 } 00167 00180 public function setPassword( $user, $password ) { 00181 return true; 00182 } 00183 00191 public function updateExternalDB( $user ) { 00192 return true; 00193 } 00194 00200 public function canCreateAccounts() { 00201 return false; 00202 } 00203 00214 public function addUser( $user, $password, $email = '', $realname = '' ) { 00215 return true; 00216 } 00217 00226 public function strict() { 00227 return false; 00228 } 00229 00237 public function strictUserAuth( $username ) { 00238 return false; 00239 } 00240 00252 public function initUser( &$user, $autocreate = false ) { 00253 # Override this to do something. 00254 } 00255 00260 public function getCanonicalName( $username ) { 00261 return $username; 00262 } 00263 00271 public function getUserInstance( User &$user ) { 00272 return new AuthPluginUser( $user ); 00273 } 00274 00280 public function domainList() { 00281 return array(); 00282 } 00283 } 00284 00285 class AuthPluginUser { 00286 function __construct( $user ) { 00287 # Override this! 00288 } 00289 00290 public function getId() { 00291 # Override this! 00292 return -1; 00293 } 00294 00295 public function isLocked() { 00296 # Override this! 00297 return false; 00298 } 00299 00300 public function isHidden() { 00301 # Override this! 00302 return false; 00303 } 00304 00305 public function resetAuthToken() { 00306 # Override this! 00307 return true; 00308 } 00309 }