jenkins-bot has submitted this change and it was merged. Change subject: Make list=novainstance available to anons ......................................................................
Make list=novainstance available to anons Right now, none of this information is available to you unless: - You are logged in - You are a member of the project I talked to Andrew and Coren, and we're all ok with making this info publicly available - nothing private here, and all of it is exposed via SMW anyway. Change-Id: Ia9ed925c1e75fce29baf9a1b81cf2a23b0eb6e0f --- M api/ApiListNovaInstances.php 1 file changed, 10 insertions(+), 11 deletions(-) Approvals: MarkTraceur: Looks good to me, approved jenkins-bot: Verified diff --git a/api/ApiListNovaInstances.php b/api/ApiListNovaInstances.php index be90e63..b369339 100644 --- a/api/ApiListNovaInstances.php +++ b/api/ApiListNovaInstances.php @@ -15,6 +15,9 @@ } public function run() { + global $wgOpenStackManagerLDAPUsername; + global $wgOpenStackManagerLDAPUserPassword; + $params = $this->extractRequestParams(); $project = OpenStackNovaProject::getProjectByName( $params['project'] ); if ( !$project ) { @@ -22,18 +25,14 @@ $this->dieUsage( 'Invalid project specified.', 'badproject' ); } - if ( !$this->getUser()->isLoggedIn() ) { - $this->dieUsage( 'Must be logged in to use this API', 'notloggedin' ); - } + $user = new OpenStackNovaUser( $wgOpenStackManagerLDAPUsername ); + $userNova = OpenStackNovaController::newFromUser( $user ); + $userNova->authenticate( $wgOpenStackManagerLDAPUsername, $wgOpenStackManagerLDAPUserPassword ); - $user = new OpenStackNovaUser(); - if ( !$user->exists() ) { - $this->dieUsage( 'NovaUser does not exist', 'baduser' ); - } - $controller = OpenStackNovaController::newFromUser( $user ); - $controller->setProject( $project->getName() ); - $controller->setRegion( $params['region'] ); // validated by API - $instances = $controller->getInstances(); + $userNova->setProject( $project->getName() ); + $userNova->setRegion( $params['region'] ); // validated by API + + $instances = $userNova->getInstances(); foreach ( $instances as $instance ) { $info = array( 'name' => $instance->getInstanceName(), -- To view, visit https://gerrit.wikimedia.org/r/166732 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia9ed925c1e75fce29baf9a1b81cf2a23b0eb6e0f Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/OpenStackManager Gerrit-Branch: wmf/1.25wmf2 Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com> Gerrit-Reviewer: MarkTraceur <mtrac...@member.fsf.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits