r80721 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80720‎ | r80721 | r80722 >
Date:22:58, 21 January 2011
Author:laner
Status:deferred
Tags:
Comment:
* Finished adding support for project roles
* Added support for global roles
* Made some interface changes to Special:Project
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackManager.i18n.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackManager.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaDomain.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaHost.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaRole.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaUser.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaProject.php (modified) (history)
  • /trunk/extensions/OpenStackManager/special/SpecialNovaRole.php (added) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php
@@ -106,16 +106,19 @@
107107 $this->setHeaders();
108108 $wgOut->setPagetitle( wfMsg( 'openstackmanager-removemember' ) );
109109
110 - $member = $wgRequest->getText( 'member' );
111 - $project = $wgRequest->getText( 'projectname' );
112 - if ( ! $wgRequest->wasPosted() ) {
113 - $out .= Html::element( 'p', array(), wfMsgExt( 'openstackmanager-removememberconfirm', array(), $member, $project ) );
114 - $wgOut->addHTML( $out );
 110+ $projectname = $wgRequest->getText( 'projectname' );
 111+ $project = OpenStackNovaProject::getProjectByName( $projectname );
 112+ $projectmembers = $project->getMembers();
 113+ $member_keys = array();
 114+ foreach ( $projectmembers as $projectmember ) {
 115+ $member_keys["$projectmember"] = $projectmember;
115116 }
116117 $projectInfo = Array();
117 - $projectInfo['member'] = array(
118 - 'type' => 'hidden',
119 - 'default' => $member,
 118+ $projectInfo['members'] = array(
 119+ 'type' => 'multiselect',
 120+ 'label-message' => 'openstackmanager-member',
 121+ 'section' => 'project/info',
 122+ 'options' => $member_keys,
120123 );
121124 $projectInfo['action'] = array(
122125 'type' => 'hidden',
@@ -123,7 +126,7 @@
124127 );
125128 $projectInfo['projectname'] = array(
126129 'type' => 'hidden',
127 - 'default' => $project,
 130+ 'default' => $projectname,
128131 );
129132
130133 $projectForm = new SpecialNovaProjectForm( $projectInfo, 'openstackmanager-novaproject' );
@@ -188,10 +191,7 @@
189192 $projectMembers = $project->getMembers();
190193 $memberOut = '';
191194 foreach ( $projectMembers as $projectMember ) {
192 - $link = $sk->link( $this->getTitle(), wfMsg( 'openstackmanager-removemember' ), array(),
193 - array( 'action' => 'deletemember', 'projectname' => $projectName, 'member' => $projectMember ), array() );
194 - $projectMemberOut = htmlentities( $projectMember ) . ' (' . $link . ')';
195 - $memberOut .= Html::rawElement( 'li', array(), $projectMemberOut );
 195+ $memberOut .= Html::rawElement( 'li', array(), $projectMember );
196196 }
197197 if ( $memberOut ) {
198198 $memberOut = Html::rawElement( 'ul', array(), $memberOut );
@@ -205,16 +205,16 @@
206206 $roleMembers = '';
207207 $specialRoleTitle = Title::newFromText( 'Special:NovaRole' );
208208 foreach ( $role->getMembers() as $member ) {
209 - $link = $sk->link( $specialRoleTitle, wfMsg( 'openstackmanager-removerolemember' ), array(),
210 - array( 'action' => 'removemember', 'projectname' => $projectName, 'rolename' => $role->getRoleName(), 'member' => $member, 'referrer' => 'Special:NovaProject' ), array() );
211 - $member = $member . ' (' . $link . ')';
212209 $roleMembers .= Html::rawElement( 'li', array(), $member );
213210 }
214211 $roleMembers = Html::rawElement( 'ul', array(), $roleMembers );
215212 $roleOut .= Html::rawElement( 'td', array(), $roleMembers );
216213 $link = $sk->link( $specialRoleTitle, wfMsg( 'openstackmanager-addrolemember' ), array(),
217 - array( 'action' => 'addmember', 'projectname' => $projectName, 'rolename' => $role->getRoleName(), 'referrer' => 'Special:NovaProject' ), array() );
 214+ array( 'action' => 'addmember', 'projectname' => $projectName, 'rolename' => $role->getRoleName(), 'returnto' => 'Special:NovaProject' ), array() );
218215 $actions = Html::rawElement( 'li', array(), $link );
 216+ $link = $sk->link( $specialRoleTitle, wfMsg( 'openstackmanager-removerolemember' ), array(),
 217+ array( 'action' => 'deletemember', 'projectname' => $projectName, 'rolename' => $role->getRoleName(), 'returnto' => 'Special:NovaProject' ), array() );
 218+ $actions .= Html::rawElement( 'li', array(), $link );
219219 $actions = Html::rawElement( 'ul', array(), $actions );
220220 $roleOut .= Html::rawElement( 'td', array(), $actions );
221221 $rolesOut .= Html::rawElement( 'tr', array(), $roleOut );
@@ -227,6 +227,9 @@
228228 $link = $sk->link( $this->getTitle(), wfMsg( 'openstackmanager-addmember' ), array(),
229229 array( 'action' => 'addmember', 'projectname' => $projectName ), array() );
230230 $actions .= Html::rawElement( 'li', array(), $link );
 231+ $link = $sk->link( $this->getTitle(), wfMsg( 'openstackmanager-removemember' ), array(),
 232+ array( 'action' => 'deletemember', 'projectname' => $projectName ), array() );
 233+ $actions .= Html::rawElement( 'li', array(), $link );
231234 $actions = Html::rawElement( 'ul', array(), $actions );
232235 $projectOut .= Html::rawElement( 'td', array(), $actions );
233236 $projectsOut .= Html::rawElement( 'tr', array(), $projectOut );
@@ -297,14 +300,21 @@
298301 global $wgOut, $wgUser;
299302
300303 $project = new OpenStackNovaProject( $formData['projectname'] );
301 - $success = $project->deleteMember( $formData['member'] );
302 - if ( $success ) {
303 - $out = Html::element( 'p', array(), wfMsgExt( 'openstackmanager-removedfrom', array(), $formData['member'],
304 - $formData['projectname'] ) );
305 - } else {
306 - $out = Html::element( 'p', array(), wfMsgExt( 'openstackmanager-failedtoremove', array(), $formData['member'],
307 - $formData['projectname'] ) );
 304+ $project = OpenStackNovaProject::getProjectByName( $formData['projectname'] );
 305+ if ( ! $project ) {
 306+ $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-nonexistentproject' ) );
 307+ $wgOut->addHTML( $out );
 308+ return true;
308309 }
 310+ $out = '';
 311+ foreach ( $formData['members'] as $member ) {
 312+ $success = $project->deleteMember( $member );
 313+ if ( $success ) {
 314+ $out = Html::element( 'p', array(), wfMsgExt( 'openstackmanager-removedfrom', array(), $formData['member'], $formData['projectname'] ) );
 315+ } else {
 316+ $out = Html::element( 'p', array(), wfMsgExt( 'openstackmanager-failedtoremove', array(), $formData['member'], $formData['projectname'] ) );
 317+ }
 318+ }
309319 $out .= '<br />';
310320 $sk = $wgUser->getSkin();
311321 $out .= $sk->link( $this->getTitle(), wfMsg( 'openstackmanager-backprojectlist' ), array(), array(), array() );
Index: trunk/extensions/OpenStackManager/special/SpecialNovaRole.php
@@ -0,0 +1,291 @@
 2+<?php
 3+class SpecialNovaRole extends SpecialNova {
 4+
 5+ var $userNova, $adminNova;
 6+
 7+ function __construct() {
 8+ parent::__construct( 'NovaRole', 'manageproject' );
 9+
 10+ global $wgOpenStackManagerNovaAdminKeys;
 11+
 12+ $this->userLDAP = new OpenStackNovaUser();
 13+ $adminCredentials = $wgOpenStackManagerNovaAdminKeys;
 14+ $this->adminNova = new OpenStackNovaController( $adminCredentials );
 15+ }
 16+
 17+ function execute( $par ) {
 18+ global $wgRequest, $wgUser;
 19+
 20+ if ( !$this->userCanExecute( $wgUser ) ) {
 21+ $this->displayRestrictionError();
 22+ return false;
 23+ }
 24+
 25+ if ( ! $wgUser->isLoggedIn() ) {
 26+ $this->notLoggedIn();
 27+ return false;
 28+ }
 29+
 30+ $action = $wgRequest->getVal( 'action' );
 31+ if ( $action == "addmember" ) {
 32+ $this->addMember();
 33+ } else if ( $action == "deletemember" ) {
 34+ $this->deleteMember();
 35+ } else {
 36+ $this->listGlobalRoles();
 37+ }
 38+ }
 39+
 40+ function addMember() {
 41+ global $wgRequest, $wgOut;
 42+
 43+ $this->setHeaders();
 44+ $wgOut->setPagetitle( wfMsg( 'openstackmanager-addmember' ) );
 45+
 46+ $roleInfo = Array();
 47+ $rolename = $wgRequest->getText( 'rolename' );
 48+ $projectname = $wgRequest->getText( 'projectname' );
 49+ if ( $projectname ) {
 50+ $project = OpenStackNovaProject::getProjectByName( $projectname );
 51+ $projectmembers = $project->getMembers();
 52+ $role = OpenStackNovaRole::getProjectRoleByName( $rolename, $projectname );
 53+ $rolemembers = $role->getMembers();
 54+ $member_keys = array();
 55+ foreach ( $projectmembers as $projectmember ) {
 56+ if ( ! in_array( $projectmember, $rolemembers ) ) {
 57+ $member_keys["$projectmember"] = $projectmember;
 58+ }
 59+ }
 60+ if ( ! $member_keys ) {
 61+ $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-nomemberstoadd' ) );
 62+ $wgOut->addHTML( $out );
 63+ return true;
 64+ }
 65+ $roleInfo['members'] = array(
 66+ 'type' => 'multiselect',
 67+ 'label-message' => 'openstackmanager-member',
 68+ 'options' => $member_keys,
 69+ 'section' => 'role/info',
 70+ );
 71+ } else {
 72+ $roleInfo['members'] = array(
 73+ 'type' => 'text',
 74+ 'label-message' => 'openstackmanager-member',
 75+ 'default' => '',
 76+ 'section' => 'role/info',
 77+ );
 78+ }
 79+ $roleInfo['action'] = array(
 80+ 'type' => 'hidden',
 81+ 'default' => 'addmember',
 82+ );
 83+ $roleInfo['rolename'] = array(
 84+ 'type' => 'hidden',
 85+ 'default' => $rolename,
 86+ );
 87+ $roleInfo['projectname'] = array(
 88+ 'type' => 'hidden',
 89+ 'default' => $projectname,
 90+ );
 91+ $roleInfo['returnto'] = array(
 92+ 'type' => 'hidden',
 93+ 'default' => $wgRequest->getText('returnto'),
 94+ );
 95+
 96+ $roleForm = new SpecialNovaRoleForm( $roleInfo, 'openstackmanager-novarole' );
 97+ $roleForm->setTitle( SpecialPage::getTitleFor( 'NovaRole' ) );
 98+ $roleForm->setSubmitID( 'novarole-form-addmembersubmit' );
 99+ $roleForm->setSubmitCallback( array( $this, 'tryAddMemberSubmit' ) );
 100+ $roleForm->show();
 101+
 102+ return true;
 103+ }
 104+
 105+ function deleteMember() {
 106+ global $wgRequest, $wgOut;
 107+
 108+ $this->setHeaders();
 109+ $wgOut->setPagetitle( wfMsg( 'openstackmanager-removerolemember' ) );
 110+
 111+ $rolename = $wgRequest->getText( 'rolename' );
 112+ $projectname = $wgRequest->getText( 'projectname' );
 113+ if ( $projectname ) {
 114+ $project = OpenStackNovaProject::getProjectByName( $projectname );
 115+ $projectmembers = $project->getMembers();
 116+ $role = OpenStackNovaRole::getProjectRoleByName( $rolename, $projectname );
 117+ $rolemembers = $role->getMembers();
 118+ $member_keys = array();
 119+ foreach ( $projectmembers as $projectmember ) {
 120+ if ( in_array( $projectmember, $rolemembers ) ) {
 121+ $member_keys["$projectmember"] = $projectmember;
 122+ }
 123+ }
 124+ } else {
 125+ $role = OpenStackNovaRole::getGlobalRoleByName( $rolename );
 126+ $rolemembers = $role->getMembers();
 127+ $member_keys = array();
 128+ foreach ( $rolemembers as $rolemember ) {
 129+ $member_keys["$rolemember"] = $rolemember;
 130+ }
 131+ }
 132+ if ( ! $member_keys ) {
 133+ $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-nomemberstoremove' ) );
 134+ $wgOut->addHTML( $out );
 135+ return true;
 136+ }
 137+ $roleInfo = Array();
 138+ $roleInfo['members'] = array(
 139+ 'type' => 'multiselect',
 140+ 'label-message' => 'openstackmanager-member',
 141+ 'options' => $member_keys,
 142+ 'section' => 'role/info',
 143+ );
 144+ $roleInfo['action'] = array(
 145+ 'type' => 'hidden',
 146+ 'default' => 'deletemember',
 147+ );
 148+ $roleInfo['rolename'] = array(
 149+ 'type' => 'hidden',
 150+ 'default' => $rolename,
 151+ );
 152+ $roleInfo['projectname'] = array(
 153+ 'type' => 'hidden',
 154+ 'default' => $projectname,
 155+ );
 156+ $roleInfo['returnto'] = array(
 157+ 'type' => 'hidden',
 158+ 'default' => $wgRequest->getText('returnto'),
 159+ );
 160+
 161+ $roleForm = new SpecialNovaRoleForm( $roleInfo, 'openstackmanager-novarole' );
 162+ $roleForm->setTitle( SpecialPage::getTitleFor( 'NovaRole' ) );
 163+ $roleForm->setSubmitID( 'novarole-form-deletemembersubmit' );
 164+ $roleForm->setSubmitCallback( array( $this, 'tryDeleteMemberSubmit' ) );
 165+ $roleForm->show();
 166+
 167+ return true;
 168+ }
 169+
 170+ function listGlobalRoles() {
 171+ global $wgOut, $wgUser;
 172+
 173+ $this->setHeaders();
 174+ $wgOut->setPagetitle( wfMsg( 'openstackmanager-rolelist' ) );
 175+
 176+ $out = '';
 177+ $sk = $wgUser->getSkin();
 178+ $rolesOut = Html::element( 'th', array(), wfMsg( 'openstackmanager-rolename' ) );
 179+ $rolesOut .= Html::element( 'th', array(), wfMsg( 'openstackmanager-members' ) );
 180+ $rolesOut .= Html::element( 'th', array(), wfMsg( 'openstackmanager-actions' ) );
 181+ $roles = OpenStackNovaRole::getAllGlobalRoles();
 182+ if ( ! $roles ) {
 183+ $rolesOut = '';
 184+ }
 185+ foreach ( $roles as $role ) {
 186+ $roleName = $role->getRoleName();
 187+ $roleOut = Html::element( 'td', array(), $roleName );
 188+ $roleMembers = $role->getMembers();
 189+ $memberOut = '';
 190+ foreach ( $roleMembers as $roleMember ) {
 191+ $memberOut .= Html::rawElement( 'li', array(), $roleMember );
 192+ }
 193+ if ( $memberOut ) {
 194+ $memberOut = Html::rawElement( 'ul', array(), $memberOut );
 195+ }
 196+ $roleOut .= Html::rawElement( 'td', array(), $memberOut );
 197+ $link = $sk->link( $this->getTitle(), wfMsg( 'openstackmanager-addrolemember' ), array(), array( 'action' => 'addmember', 'rolename' => $roleName, 'returnto' => 'Special:NovaRole' ), array() );
 198+ $actions = Html::rawElement( 'li', array(), $link );
 199+ $link = $sk->link( $this->getTitle(), wfMsg( 'openstackmanager-removerolemember' ), array(), array( 'action' => 'deletemember', 'rolename' => $roleName, 'returnto' => 'Special:NovaRole' ), array() );
 200+ $actions .= Html::rawElement( 'li', array(), $link );
 201+ $actions = Html::rawElement( 'ul', array(), $actions );
 202+ $roleOut .= Html::rawElement( 'td', array(), $actions );
 203+ $rolesOut .= Html::rawElement( 'tr', array(), $roleOut );
 204+ }
 205+ if ( $rolesOut ) {
 206+ $out .= Html::rawElement( 'table', array( 'class' => 'wikitable' ), $rolesOut );
 207+ }
 208+
 209+ $wgOut->addHTML( $out );
 210+ }
 211+
 212+ function tryAddMemberSubmit( $formData, $entryPoint = 'internal' ) {
 213+ global $wgOut, $wgUser;
 214+
 215+ $projectname = $formData['projectname'];
 216+ if ( $projectname ) {
 217+ $project = OpenStackNovaProject::getProjectByName( $projectname );
 218+ if ( ! $project ) {
 219+ $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-nonexistentproject' ) );
 220+ $wgOut->addHTML( $out );
 221+ return true;
 222+ }
 223+ $role = OpenStackNovaRole::getProjectRoleByName( $formData['rolename'], $project );
 224+ $members = $formData['members'];
 225+ } else {
 226+ $role = OpenStackNovaRole::getGlobalRoleByName( $formData['rolename'] );
 227+ $members = array( $formData['members'] );
 228+ }
 229+ if ( ! $role ) {
 230+ $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-nonexistentrole' ) );
 231+ $wgOut->addHTML( $out );
 232+ return true;
 233+ }
 234+ $out = '';
 235+ foreach ( $members as $member ) {
 236+ $success = $role->addMember( $member );
 237+ if ( $success ) {
 238+ $out .= Html::element( 'p', array(), wfMsgExt( 'openstackmanager-addedto', array(), $member, $formData['rolename'] ) );
 239+ } else {
 240+ $out .= Html::element( 'p', array(), wfMsgExt( 'openstackmanager-failedtoadd', array(), $member, $formData['rolename'] ) );
 241+ }
 242+ }
 243+ $out .= '<br />';
 244+ $sk = $wgUser->getSkin();
 245+ $returnto = Title::newFromText( $formData['returnto'] );
 246+ $out .= $sk->link( $returnto, wfMsg( 'openstackmanager-backprojectlist' ), array(), array(), array() );
 247+ $wgOut->addHTML( $out );
 248+
 249+ return true;
 250+ }
 251+
 252+ function tryDeleteMemberSubmit( $formData, $entryPoint = 'internal' ) {
 253+ global $wgOut, $wgUser;
 254+
 255+ $projectname = $formData['projectname'];
 256+ if ( $projectname ) {
 257+ $project = OpenStackNovaProject::getProjectByName( $projectname );
 258+ if ( ! $project ) {
 259+ $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-nonexistentproject' ) );
 260+ $wgOut->addHTML( $out );
 261+ return true;
 262+ }
 263+ $role = OpenStackNovaRole::getProjectRoleByName( $formData['rolename'], $project );
 264+ } else {
 265+ $role = OpenStackNovaRole::getGlobalRoleByName( $formData['rolename'] );
 266+ }
 267+ if ( ! $role ) {
 268+ $out = Html::element( 'p', array(), wfMsg( 'openstackmanager-nonexistentrole' ) );
 269+ $wgOut->addHTML( $out );
 270+ return true;
 271+ }
 272+ $out = '';
 273+ foreach ( $formData['members'] as $member ) {
 274+ $success = $role->deleteMember( $member );
 275+ if ( $success ) {
 276+ $out .= Html::element( 'p', array(), wfMsgExt( 'openstackmanager-removedfrom', array(), $member, $formData['rolename'] ) );
 277+ } else {
 278+ $out .= Html::element( 'p', array(), wfMsgExt( 'openstackmanager-failedtoremove', array(), $member, $formData['rolename'] ) );
 279+ }
 280+ }
 281+ $out .= '<br />';
 282+ $sk = $wgUser->getSkin();
 283+ $returnto = Title::newFromText( $formData['returnto'] );
 284+ $out .= $sk->link( $returnto, wfMsg( 'openstackmanager-backprojectlist' ), array(), array(), array() );
 285+ $wgOut->addHTML( $out );
 286+
 287+ return true;
 288+ }
 289+}
 290+
 291+class SpecialNovaRoleForm extends HTMLForm {
 292+}
Property changes on: trunk/extensions/OpenStackManager/special/SpecialNovaRole.php
___________________________________________________________________
Added: svn:eol-style
1293 + native
Index: trunk/extensions/OpenStackManager/OpenStackNovaRole.php
@@ -5,6 +5,7 @@
66 var $rolename;
77 var $roleDN;
88 var $roleInfo;
 9+ var $project;
910 var $global;
1011
1112 function __construct( $rolename, $project=null ) {
@@ -37,15 +38,17 @@
3839 if ( $this->global ) {
3940 if ( isset ( $wgOpenStackManagerLDAPGlobalRoles["$this->rolename"] ) ) {
4041 $dn = $wgOpenStackManagerLDAPGlobalRoles["$this->rolename"];
 42+ $query = '(objectclass=groupofnames)';
4143 } else {
4244 # This condition would be a bug...
4345 $dn = '';
4446 }
4547 } else {
4648 $dn = $this->project->projectDN;
 49+ $query = '(cn=' . $this->rolename . ')';
4750 }
4851 wfSuppressWarnings();
49 - $result = ldap_search( $wgAuth->ldapconn, $dn, '(cn=' . $this->rolename . ')' );
 52+ $result = ldap_search( $wgAuth->ldapconn, $dn, $query );
5053 $this->roleInfo = ldap_get_entries( $wgAuth->ldapconn, $result );
5154 wfRestoreWarnings();
5255 $this->roleDN = $this->roleInfo[0]['dn'];
@@ -96,6 +99,7 @@
97100 $success = ldap_modify( $wgAuth->ldapconn, $this->roleDN, $values );
98101 wfRestoreWarnings();
99102 if ( $success ) {
 103+ $this->fetchRoleInfo();
100104 $wgAuth->printDebug( "Successfully removed $user->userDN from $this->roleDN", NONSENSITIVE );
101105 return true;
102106 } else {
@@ -126,6 +130,7 @@
127131 $success = ldap_modify( $wgAuth->ldapconn, $this->roleDN, $values );
128132 wfRestoreWarnings();
129133 if ( $success ) {
 134+ $this->fetchRoleInfo();
130135 $wgAuth->printDebug( "Successfully added $user->userDN to $this->roleDN", NONSENSITIVE );
131136 return true;
132137 } else {
Index: trunk/extensions/OpenStackManager/OpenStackManager.i18n.php
@@ -113,7 +113,6 @@
114114
115115 'openstackmanager-addmember' => 'Add project member',
116116 'openstackmanager-removemember' => 'Remove project member',
117 - 'openstackmanager-removememberconfirm' => 'Are you sure you wish to remove $1 from project $2?',
118117 'openstackmanager-removeprojectconfirm' => 'Are you sure you wish to delete project "$1"? This action has reprecusions on all VMs. Do not take this action lightly!',
119118 'openstackmanager-createproject' => 'Create a new project',
120119 'openstackmanager-projectname' => 'Project name',
@@ -134,10 +133,15 @@
135134 'openstackmanager-badinstancename' => 'Bad instance name provided. Instance names must start with a-z, and can only contain a-z, 0-9, and - characters.',
136135 'openstackmanager-novaproject-project' => 'Project',
137136 'openstackmanager-novaproject-info' => 'Project Information',
 137+
138138 'openstackmanager-roles' => 'Roles',
139139 'openstackmanager-rolename' => 'Role Name',
140140 'openstackmanager-removerolemember' => 'Remove role member',
141141 'openstackmanager-addrolemember' => 'Add role member',
 142+ 'openstackmanager-rolelist' => 'Global Role List',
 143+ 'openstackmanager-nomemberstoremove' => 'There are no members to remove from this group',
 144+ 'openstackmanager-novarole-role' => 'Nova Role',
 145+ 'openstackmanager-novarole-info' => 'Nova Role Information',
142146
143147 'openstackmanager-shellaccountname' => 'Instance Shell Account Name',
144148 'openstackmanager-shellaccountnamehelp' => 'The shell account name must start with a-z, and can only contain a-z, 0-9, -, and _ characters.',
Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php
@@ -90,6 +90,12 @@
9191 $success = ldap_modify( $wgAuth->ldapconn, $this->projectDN, $values );
9292 wfRestoreWarnings();
9393 if ( $success ) {
 94+ foreach ( $this->roles as $role ) {
 95+ $success = $role->deleteMember( $username );
 96+ #TODO: Find a way to fail gracefully if role member
 97+ # deletion fails
 98+ }
 99+ $this->fetchProjectInfo();
94100 $wgAuth->printDebug( "Successfully removed $user->userDN from $this->projectDN", NONSENSITIVE );
95101 return true;
96102 } else {
@@ -120,6 +126,7 @@
121127 $success = ldap_modify( $wgAuth->ldapconn, $this->projectDN, $values );
122128 wfRestoreWarnings();
123129 if ( $success ) {
 130+ $this->fetchProjectInfo();
124131 $wgAuth->printDebug( "Successfully added $user->userDN to $this->projectDN", NONSENSITIVE );
125132 return true;
126133 } else {
Index: trunk/extensions/OpenStackManager/OpenStackNovaDomain.php
@@ -62,6 +62,7 @@
6363 wfRestoreWarnings();
6464 if ( $success ) {
6565 $wgAuth->printDebug( "Successfully modified soarecord for " . $this->domainDN, NONSENSITIVE );
 66+ $this->fetchDomainInfo();
6667 return true;
6768 } else {
6869 $wgAuth->printDebug( "Failed to modify soarecord for " . $this->domainDN, NONSENSITIVE );
Index: trunk/extensions/OpenStackManager/OpenStackNovaHost.php
@@ -124,6 +124,7 @@
125125 $success = ldap_modify( $wgAuth->ldapconn, $this->hostDN, $hostEntry );
126126 wfRestoreWarnings();
127127 if ( $success ) {
 128+ $this->fetchHostInfo();
128129 $wgAuth->printDebug( "Successfully modified puppet configuration for host", NONSENSITIVE );
129130 return true;
130131 } else {
@@ -159,6 +160,7 @@
160161 if ( $success ) {
161162 $wgAuth->printDebug( "Successfully removed $fqdn from $this->hostDN", NONSENSITIVE );
162163 $this->domain->updateSOA();
 164+ $this->fetchHostInfo();
163165 return true;
164166 } else {
165167 $wgAuth->printDebug( "Failed to remove $fqdn from $this->hostDN", NONSENSITIVE );
@@ -191,6 +193,7 @@
192194 if ( $success ) {
193195 $wgAuth->printDebug( "Successfully removed $ip from $this->hostDN", NONSENSITIVE );
194196 $this->domain->updateSOA();
 197+ $this->fetchHostInfo();
195198 return true;
196199 } else {
197200 $wgAuth->printDebug( "Failed to remove $ip from $this->hostDN", NONSENSITIVE );
@@ -217,6 +220,7 @@
218221 if ( $success ) {
219222 $wgAuth->printDebug( "Successfully added $fqdn to $this->hostDN", NONSENSITIVE );
220223 $this->domain->updateSOA();
 224+ $this->fetchHostInfo();
221225 return true;
222226 } else {
223227 $wgAuth->printDebug( "Failed to add $fqdn to $this->hostDN", NONSENSITIVE );
@@ -240,6 +244,7 @@
241245 if ( $success ) {
242246 $wgAuth->printDebug( "Successfully added $ip to $this->hostDN", NONSENSITIVE );
243247 $this->domain->updateSOA();
 248+ $this->fetchHostInfo();
244249 return true;
245250 } else {
246251 $wgAuth->printDebug( "Failed to add $ip to $this->hostDN", NONSENSITIVE );
@@ -257,6 +262,7 @@
258263 if ( $success ) {
259264 $wgAuth->printDebug( "Successfully set $ip on $this->hostDN", NONSENSITIVE );
260265 $this->domain->updateSOA();
 266+ $this->fetchHostInfo();
261267 return true;
262268 } else {
263269 $wgAuth->printDebug( "Failed to set $ip on $this->hostDN", NONSENSITIVE );
Index: trunk/extensions/OpenStackManager/OpenStackNovaUser.php
@@ -226,6 +226,7 @@
227227 wfRestoreWarnings();
228228 if ( $success ) {
229229 $wgAuth->printDebug( "Successfully imported the user's sshpublickey", NONSENSITIVE );
 230+ $this->fetchUserInfo();
230231 return true;
231232 } else {
232233 $wgAuth->printDebug( "Failed to import the user's sshpublickey", NONSENSITIVE );
@@ -254,6 +255,7 @@
255256 wfRestoreWarnings();
256257 if ( $success ) {
257258 $wgAuth->printDebug( "Successfully deleted the user's sshpublickey", NONSENSITIVE );
 259+ $this->fetchHostInfo();
258260 return true;
259261 } else {
260262 $wgAuth->printDebug( "Failed to delete the user's sshpublickey", NONSENSITIVE );
Index: trunk/extensions/OpenStackManager/OpenStackManager.php
@@ -21,7 +21,7 @@
2222 'path' => __FILE__,
2323 'name' => 'OpenStackManager',
2424 'author' => 'Ryan Lane',
25 - 'version' => '0.8',
 25+ 'version' => '0.9',
2626 'url' => 'http://mediawiki.org/wiki/Extension:OpenStackManager',
2727 'descriptionmsg' => 'openstackmanager-desc',
2828 );
@@ -82,6 +82,7 @@
8383 $wgAutoloadClasses['SpecialNovaDomain'] = $dir . 'special/SpecialNovaDomain.php';
8484 $wgAutoloadClasses['SpecialNovaAddress'] = $dir . 'special/SpecialNovaAddress.php';
8585 $wgAutoloadClasses['SpecialNovaSecurityGroup'] = $dir . 'special/SpecialNovaSecurityGroup.php';
 86+$wgAutoloadClasses['SpecialNovaRole'] = $dir . 'special/SpecialNovaRole.php';
8687 $wgAutoloadClasses['SpecialNova'] = $dir . 'special/SpecialNova.php';
8788 $wgAutoloadClasses['OpenStackNovaHostJob'] = $dir . 'OpenStackNovaHostJob.php';
8889 $wgAutoloadClasses['AmazonEC2'] = $dir . 'aws-sdk/sdk.class.php';
@@ -97,6 +98,8 @@
9899 $wgSpecialPageGroups['NovaAddress'] = 'nova';
99100 $wgSpecialPages['NovaSecurityGroup'] = 'SpecialNovaSecurityGroup';
100101 $wgSpecialPageGroups['NovaSecurityGroup'] = 'nova';
 102+$wgSpecialPages['NovaRole'] = 'SpecialNovaRole';
 103+$wgSpecialPageGroups['NovaRole'] = 'nova';
101104 $wgJobClasses['addDNSHostToLDAP'] = 'OpenStackNovaHostJob';
102105
103106 $wgHooks['LDAPSetCreationValues'][] = 'OpenStackNovaUser::LDAPSetCreationValues';

Status & tagging log