MediaWiki
REL1_21
|
00001 <?php 00036 class AuthPlugin { 00037 00041 protected $domain; 00042 00052 public function userExists( $username ) { 00053 # Override this! 00054 return false; 00055 } 00056 00067 public function authenticate( $username, $password ) { 00068 # Override this! 00069 return false; 00070 } 00071 00078 public function modifyUITemplate( &$template, &$type ) { 00079 # Override this! 00080 $template->set( 'usedomain', false ); 00081 } 00082 00088 public function setDomain( $domain ) { 00089 $this->domain = $domain; 00090 } 00091 00097 public function getDomain() { 00098 if ( isset( $this->domain ) ) { 00099 return $this->domain; 00100 } else { 00101 return 'invaliddomain'; 00102 } 00103 } 00104 00111 public function validDomain( $domain ) { 00112 # Override this! 00113 return true; 00114 } 00115 00127 public function updateUser( &$user ) { 00128 # Override this and do something 00129 return true; 00130 } 00131 00145 public function autoCreate() { 00146 return false; 00147 } 00148 00158 public function allowPropChange( $prop = '' ) { 00159 if ( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) { 00160 return $this->allowRealNameChange(); 00161 } elseif ( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) { 00162 return $this->allowEmailChange(); 00163 } elseif ( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) { 00164 return $this->allowNickChange(); 00165 } else { 00166 return true; 00167 } 00168 } 00169 00175 public function allowPasswordChange() { 00176 return true; 00177 } 00178 00184 public function allowSetLocalPassword() { 00185 return true; 00186 } 00187 00200 public function setPassword( $user, $password ) { 00201 return true; 00202 } 00203 00211 public function updateExternalDB( $user ) { 00212 return true; 00213 } 00214 00220 public function canCreateAccounts() { 00221 return false; 00222 } 00223 00234 public function addUser( $user, $password, $email = '', $realname = '' ) { 00235 return true; 00236 } 00237 00246 public function strict() { 00247 return false; 00248 } 00249 00257 public function strictUserAuth( $username ) { 00258 return false; 00259 } 00260 00272 public function initUser( &$user, $autocreate = false ) { 00273 # Override this to do something. 00274 } 00275 00282 public function getCanonicalName( $username ) { 00283 return $username; 00284 } 00285 00293 public function getUserInstance( User &$user ) { 00294 return new AuthPluginUser( $user ); 00295 } 00296 00302 public function domainList() { 00303 return array(); 00304 } 00305 } 00306 00307 class AuthPluginUser { 00308 function __construct( $user ) { 00309 # Override this! 00310 } 00311 00312 public function getId() { 00313 # Override this! 00314 return -1; 00315 } 00316 00317 public function isLocked() { 00318 # Override this! 00319 return false; 00320 } 00321 00322 public function isHidden() { 00323 # Override this! 00324 return false; 00325 } 00326 00327 public function resetAuthToken() { 00328 # Override this! 00329 return true; 00330 } 00331 }