MediaWiki
REL1_24
|
00001 <?php 00036 class AuthPlugin { 00040 protected $domain; 00041 00051 public function userExists( $username ) { 00052 # Override this! 00053 return false; 00054 } 00055 00066 public function authenticate( $username, $password ) { 00067 # Override this! 00068 return false; 00069 } 00070 00077 public function modifyUITemplate( &$template, &$type ) { 00078 # Override this! 00079 $template->set( 'usedomain', false ); 00080 } 00081 00087 public function setDomain( $domain ) { 00088 $this->domain = $domain; 00089 } 00090 00096 public function getDomain() { 00097 if ( isset( $this->domain ) ) { 00098 return $this->domain; 00099 } else { 00100 return 'invaliddomain'; 00101 } 00102 } 00103 00110 public function validDomain( $domain ) { 00111 # Override this! 00112 return true; 00113 } 00114 00126 public function updateUser( &$user ) { 00127 # Override this and do something 00128 return true; 00129 } 00130 00144 public function autoCreate() { 00145 return false; 00146 } 00147 00157 public function allowPropChange( $prop = '' ) { 00158 if ( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) { 00159 return $this->allowRealNameChange(); 00160 } elseif ( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) { 00161 return $this->allowEmailChange(); 00162 } elseif ( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) { 00163 return $this->allowNickChange(); 00164 } else { 00165 return true; 00166 } 00167 } 00168 00174 public function allowPasswordChange() { 00175 return true; 00176 } 00177 00183 public function allowSetLocalPassword() { 00184 return true; 00185 } 00186 00199 public function setPassword( $user, $password ) { 00200 return true; 00201 } 00202 00210 public function updateExternalDB( $user ) { 00211 return true; 00212 } 00213 00223 public function updateExternalDBGroups( $user, $addgroups, $delgroups = array() ) { 00224 return true; 00225 } 00226 00232 public function canCreateAccounts() { 00233 return false; 00234 } 00235 00246 public function addUser( $user, $password, $email = '', $realname = '' ) { 00247 return true; 00248 } 00249 00258 public function strict() { 00259 return false; 00260 } 00261 00269 public function strictUserAuth( $username ) { 00270 return false; 00271 } 00272 00284 public function initUser( &$user, $autocreate = false ) { 00285 # Override this to do something. 00286 } 00287 00294 public function getCanonicalName( $username ) { 00295 return $username; 00296 } 00297 00305 public function getUserInstance( User &$user ) { 00306 return new AuthPluginUser( $user ); 00307 } 00308 00314 public function domainList() { 00315 return array(); 00316 } 00317 } 00318 00319 class AuthPluginUser { 00320 function __construct( $user ) { 00321 # Override this! 00322 } 00323 00324 public function getId() { 00325 # Override this! 00326 return -1; 00327 } 00328 00329 public function isLocked() { 00330 # Override this! 00331 return false; 00332 } 00333 00334 public function isHidden() { 00335 # Override this! 00336 return false; 00337 } 00338 00339 public function resetAuthToken() { 00340 # Override this! 00341 return true; 00342 } 00343 }