r108092 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108091‎ | r108092 | r108093 >
Date:22:02, 4 January 2012
Author:laner
Status:ok
Tags:
Comment:
Only allow project creation if a member of cloudadmin
Modified paths:
  • /trunk/extensions/OpenStackManager/special/SpecialNovaProject.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/special/SpecialNovaProject.php
@@ -161,45 +161,47 @@
162162 $this->getOutput()->setPageTitle( wfMsg( 'openstackmanager-projectlist' ) );
163163 $this->getOutput()->addModuleStyles( 'ext.openstack' );
164164
165 - $projectInfo = array();
166 - $projectInfo['projectname'] = array(
167 - 'type' => 'text',
168 - 'label-message' => 'openstackmanager-projectname',
169 - 'validation-callback' => array( $this, 'validateText' ),
170 - 'default' => '',
171 - 'section' => 'project',
172 - 'name' => 'projectname',
173 - );
174 - $projectInfo['member'] = array(
175 - 'type' => 'text',
176 - 'label-message' => 'openstackmanager-member',
177 - 'default' => '',
178 - 'section' => 'project',
179 - 'name' => 'member',
180 - );
181 - $role_keys = array();
182 - foreach ( OpenStackNovaProject::$rolenames as $rolename ) {
183 - $role_keys["$rolename"] = $rolename;
184 - }
185 - $projectInfo['roles'] = array(
186 - 'type' => 'multiselect',
187 - 'label-message' => 'openstackmanager-roles',
188 - 'section' => 'project',
189 - 'options' => $role_keys,
190 - 'name' => 'roles',
191 - );
 165+ if ( $this->userLDAP->inGlobalRole( 'cloudadmin' ) ) {
 166+ $projectInfo = array();
 167+ $projectInfo['projectname'] = array(
 168+ 'type' => 'text',
 169+ 'label-message' => 'openstackmanager-projectname',
 170+ 'validation-callback' => array( $this, 'validateText' ),
 171+ 'default' => '',
 172+ 'section' => 'project',
 173+ 'name' => 'projectname',
 174+ );
 175+ $projectInfo['member'] = array(
 176+ 'type' => 'text',
 177+ 'label-message' => 'openstackmanager-member',
 178+ 'default' => '',
 179+ 'section' => 'project',
 180+ 'name' => 'member',
 181+ );
 182+ $role_keys = array();
 183+ foreach ( OpenStackNovaProject::$rolenames as $rolename ) {
 184+ $role_keys["$rolename"] = $rolename;
 185+ }
 186+ $projectInfo['roles'] = array(
 187+ 'type' => 'multiselect',
 188+ 'label-message' => 'openstackmanager-roles',
 189+ 'section' => 'project',
 190+ 'options' => $role_keys,
 191+ 'name' => 'roles',
 192+ );
192193
193 - $projectInfo['action'] = array(
194 - 'type' => 'hidden',
195 - 'default' => 'create',
196 - 'name' => 'action',
197 - );
 194+ $projectInfo['action'] = array(
 195+ 'type' => 'hidden',
 196+ 'default' => 'create',
 197+ 'name' => 'action',
 198+ );
198199
199 - $projectForm = new SpecialNovaProjectForm( $projectInfo, 'openstackmanager-novaproject' );
200 - $projectForm->setTitle( SpecialPage::getTitleFor( 'NovaProject' ) );
201 - $projectForm->setSubmitID( 'novaproject-form-createprojectsubmit' );
202 - $projectForm->setSubmitCallback( array( $this, 'tryCreateSubmit' ) );
203 - $projectForm->show();
 200+ $projectForm = new SpecialNovaProjectForm( $projectInfo, 'openstackmanager-novaproject' );
 201+ $projectForm->setTitle( SpecialPage::getTitleFor( 'NovaProject' ) );
 202+ $projectForm->setSubmitID( 'novaproject-form-createprojectsubmit' );
 203+ $projectForm->setSubmitCallback( array( $this, 'tryCreateSubmit' ) );
 204+ $projectForm->show();
 205+ }
204206
205207 $out = '';
206208

Status & tagging log