MediaWiki
REL1_22
|
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 00224 public function updateExternalDBGroups( $user, $addgroups, $delgroups = array() ) { 00225 return true; 00226 } 00227 00233 public function canCreateAccounts() { 00234 return false; 00235 } 00236 00247 public function addUser( $user, $password, $email = '', $realname = '' ) { 00248 return true; 00249 } 00250 00259 public function strict() { 00260 return false; 00261 } 00262 00270 public function strictUserAuth( $username ) { 00271 return false; 00272 } 00273 00285 public function initUser( &$user, $autocreate = false ) { 00286 # Override this to do something. 00287 } 00288 00295 public function getCanonicalName( $username ) { 00296 return $username; 00297 } 00298 00306 public function getUserInstance( User &$user ) { 00307 return new AuthPluginUser( $user ); 00308 } 00309 00315 public function domainList() { 00316 return array(); 00317 } 00318 } 00319 00320 class AuthPluginUser { 00321 function __construct( $user ) { 00322 # Override this! 00323 } 00324 00325 public function getId() { 00326 # Override this! 00327 return -1; 00328 } 00329 00330 public function isLocked() { 00331 # Override this! 00332 return false; 00333 } 00334 00335 public function isHidden() { 00336 # Override this! 00337 return false; 00338 } 00339 00340 public function resetAuthToken() { 00341 # Override this! 00342 return true; 00343 } 00344 }