Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php |
— | — | @@ -58,6 +58,23 @@ |
59 | 59 | 'section' => 'project/info', |
60 | 60 | 'name' => 'projectname', |
61 | 61 | ); |
| 62 | + $projectInfo['member'] = array( |
| 63 | + 'type' => 'text', |
| 64 | + 'label-message' => 'openstackmanager-member', |
| 65 | + 'default' => '', |
| 66 | + 'section' => 'project/membership', |
| 67 | + 'name' => 'member', |
| 68 | + ); |
| 69 | + foreach ( OpenStackNovaProject::$rolenames as $rolename ) { |
| 70 | + $role_keys["$rolename"] = $rolename; |
| 71 | + } |
| 72 | + $projectInfo['roles'] = array( |
| 73 | + 'type' => 'multiselect', |
| 74 | + 'label-message' => 'openstackmanager-roles', |
| 75 | + 'section' => 'project/membership', |
| 76 | + 'options' => $role_keys, |
| 77 | + 'name' => 'roles', |
| 78 | + ); |
62 | 79 | |
63 | 80 | $projectInfo['action'] = array( |
64 | 81 | 'type' => 'hidden', |
— | — | @@ -299,7 +316,18 @@ |
300 | 317 | return true; |
301 | 318 | } |
302 | 319 | $project = OpenStackNovaProject::getProjectByName( $formData['projectname'] ); |
303 | | - $project->editArticle(); |
| 320 | + $members = explode( ',', $formData['member'] ); |
| 321 | + foreach ( $members as $member ) { |
| 322 | + $project->addMember( $formData['member'] ); |
| 323 | + } |
| 324 | + $roles = $project->getRoles(); |
| 325 | + foreach ( $roles as $role ) { |
| 326 | + if ( in_array( $role->getRoleName(), $formData['roles'] ) ) { |
| 327 | + foreach ( $members as $member ) { |
| 328 | + $role->addMember( $member ); |
| 329 | + } |
| 330 | + } |
| 331 | + } |
304 | 332 | # Create a default security group for this project, and add configured default rules |
305 | 333 | $groupname = 'default'; |
306 | 334 | # Change the connection to reference this project |
— | — | @@ -343,6 +371,7 @@ |
344 | 372 | } |
345 | 373 | # Reset connection to default |
346 | 374 | $this->adminNova->configureConnection(); |
| 375 | + $project->editArticle(); |
347 | 376 | $wgOut->addWikiMsg( 'openstackmanager-createdproject' ); |
348 | 377 | $sk = $wgOut->getSkin(); |
349 | 378 | $out = '<br />'; |
— | — | @@ -385,12 +414,15 @@ |
386 | 415 | global $wgOut; |
387 | 416 | |
388 | 417 | $project = new OpenStackNovaProject( $formData['projectname'] ); |
389 | | - $success = $project->addMember( $formData['member'] ); |
390 | | - if ( $success ) { |
391 | | - $project->editArticle(); |
392 | | - $wgOut->addWikiMsg( 'openstackmanager-addedto', $formData['member'], $formData['projectname'] ); |
393 | | - } else { |
394 | | - $wgOut->addWikiMsg( 'openstackmanager-failedtoadd', $formData['member'], $formData['projectname'] ); |
| 418 | + $members = explode( ',', $formData['member'] ); |
| 419 | + foreach ( $members as $member ) { |
| 420 | + $success = $project->addMember( $member ); |
| 421 | + if ( $success ) { |
| 422 | + $project->editArticle(); |
| 423 | + $wgOut->addWikiMsg( 'openstackmanager-addedto', $formData['member'], $formData['projectname'] ); |
| 424 | + } else { |
| 425 | + $wgOut->addWikiMsg( 'openstackmanager-failedtoadd', $formData['member'], $formData['projectname'] ); |
| 426 | + } |
395 | 427 | } |
396 | 428 | $sk = $wgOut->getSkin(); |
397 | 429 | $out = '<br />'; |
Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php |
— | — | @@ -185,6 +185,7 @@ |
186 | 186 | 'openstackmanager-failedtoremove' => 'Failed to remove $1 from $2.', |
187 | 187 | 'openstackmanager-novaproject-project' => 'Project', |
188 | 188 | 'openstackmanager-novaproject-info' => 'Project information', |
| 189 | + 'openstackmanager-novaproject-membership' => 'Project membership', |
189 | 190 | |
190 | 191 | 'openstackmanager-roles' => 'Roles', |
191 | 192 | 'openstackmanager-rolename' => 'Role name', |