r79317 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79316‎ | r79317 | r79318 >
Date:02:45, 31 December 2010
Author:laner
Status:deferred
Tags:
Comment:
* Minor formatting fixes
* Backend support for adding shell accounts
** Shell acount usernames are limited to /^[a-z][a-z0-9\-_]$/; user account creation fails if a shell account isn't provided, or it in an invalid username
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackManager.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php
@@ -271,6 +271,7 @@
272272 */
273273 static function LDAPSetCreationValues( $auth, $username, &$values, &$result ) {
274274 global $wgOpenStackManagerLDAPDefaultGid;
 275+ global $wgRequest;
275276
276277 $values['objectclass'][] = 'person';
277278 $values['objectclass'][] = 'novauser';
@@ -285,6 +286,16 @@
286287 $result = false;
287288 return false;
288289 }
 290+ $values['cn'] = $username;
 291+ if ( '' != $auth->realname ) {
 292+ $values['displayname'] = $auth->realname;
 293+ }
 294+ $username = $wgRequest->getText('shellaccountname');
 295+ if ( ! preg_match( "/^[a-z][a-z0-9\-_]*$/", $username ) ) {
 296+ $result = false;
 297+ return false;
 298+ }
 299+ $values['uid'] = $username;
289300 $values['uidnumber'] = $uidnumber;
290301 $values['gidnumber'] = $wgOpenStackManagerLDAPDefaultGid;
291302 $values['homedirectory'] = '/home/' . $username;
Index: trunk/extensions/OpenStackManager/OpenStackManager.php
@@ -46,11 +46,11 @@
4747 $wgOpenStackManagerDNSSOA = array( 'hostmaster' => 'hostmaster@localhost.localdomain', 'refresh' => '1800', 'retry' => '3600', 'expiry' => '86400', 'minimum' => '7200' );
4848 $wgOpenStackManagerPuppetOptions = array(
4949 'enabled' => false,
50 - 'defaultclasses' => array(),
51 - 'defaultvariables' => array(),
52 - 'availableclasses' => array(),
53 - 'availablevariables' => array(),
54 - );
 50+ 'defaultclasses' => array(),
 51+ 'defaultvariables' => array(),
 52+ 'availableclasses' => array(),
 53+ 'availablevariables' => array(),
 54+ );
5555
5656 $dir = dirname(__FILE__) . '/';
5757

Status & tagging log