function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $this->checkTwoFactor();
     $this->userNova = OpenStackNovaController::newFromUser($this->userLDAP);
     $action = $this->getRequest()->getVal('action');
     if ($action === "delete") {
         $this->deleteProject();
     } elseif ($action === "addmember") {
         $this->addMember();
     } elseif ($action === "deletemember") {
         $this->deleteMember();
     } elseif ($action === "configureproject") {
         $this->configureProject();
     } elseif ($action === "displayquotas") {
         $this->displayQuotas();
     } else {
         $this->listProjects();
     }
 }
 function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $this->checkTwoFactor();
     $action = $this->getRequest()->getVal('action');
     if ($action === "create") {
         $this->createPuppetGroup();
     } elseif ($action === "delete") {
         $this->deletePuppetGroup();
     } elseif ($action === "addvar") {
         $this->addPuppetVar();
     } elseif ($action === "deletevar") {
         $this->deletePuppetVar();
     } elseif ($action === "addclass") {
         $this->addPuppetClass();
     } elseif ($action === "deleteclass") {
         $this->deletePuppetClass();
     } elseif ($action === "modifyclass") {
         $this->modifyPuppetClass();
     } elseif ($action === "modifyvar") {
         $this->modifyPuppetVar();
         //} elseif ( $action === "modify" ) {
         //	$this->modifyPuppetGroup();
     } else {
         $this->listPuppetGroups();
     }
 }
 function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $this->checkTwoFactor();
     $project = $this->getRequest()->getText('project');
     $region = $this->getRequest()->getText('region');
     $this->userNova = OpenStackNovaController::newFromUser($this->userLDAP);
     $this->userNova->setProject($project);
     $this->userNova->setRegion($region);
     $action = $this->getRequest()->getVal('action');
     if ($action === "create") {
         $this->createSecurityGroup();
     } elseif ($action === "delete") {
         $this->deleteSecurityGroup();
     } elseif ($action === "addrule") {
         $this->addRule();
     } elseif ($action === "removerule") {
         $this->removeRule();
     } else {
         $this->listSecurityGroups();
     }
 }
	function execute( $par ) {
		global $wgOpenStackManagerNovaAdminKeys;

		if ( !$this->getUser()->isLoggedIn() ) {
			$this->notLoggedIn();
			return;
		}
		$this->userLDAP = new OpenStackNovaUser();
		if ( !$this->userLDAP->exists() ) {
			$this->noCredentials();
			return;
		}
		$adminCredentials = $wgOpenStackManagerNovaAdminKeys;
		$this->adminNova = new OpenStackNovaController( $adminCredentials );

		$action = $this->getRequest()->getVal( 'action' );
		if ( $action == "allocate" ) {
			$this->allocateAddress();
		} elseif ( $action == "release" ) {
			$this->releaseAddress();
		} elseif ( $action == "associate" ) {
			$this->associateAddress();
		} elseif ( $action == "disassociate" ) {
			$this->disassociateAddress();
		} elseif ( $action == "addhost" ) {
			$this->addHost();
		} elseif ( $action == "removehost" ) {
			$this->removehost();
		} else {
			$this->listAddresses();
		}
	}
 function execute($par)
 {
     global $wgOpenStackManagerNovaAdminKeys;
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $adminCredentials = $wgOpenStackManagerNovaAdminKeys;
     $this->adminNova = new OpenStackNovaController($adminCredentials);
     $action = $this->getRequest()->getVal('action');
     if ($action == "create") {
         $this->createSecurityGroup();
     } elseif ($action == "delete") {
         $this->deleteSecurityGroup();
     } elseif ($action == "configure") {
         // Currently unsupported
         #$this->configureSecurityGroup();
         $this->listSecurityGroups();
     } elseif ($action == "addrule") {
         $this->addRule();
     } elseif ($action == "removerule") {
         $this->removeRule();
     } else {
         $this->listSecurityGroups();
     }
 }
 function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $this->checkTwoFactor();
     $project = $this->getRequest()->getText('project');
     $region = $this->getRequest()->getText('region');
     $this->userNova = OpenStackNovaController::newFromUser($this->userLDAP);
     $this->userNova->setProject($project);
     $this->userNova->setRegion($region);
     $action = $this->getRequest()->getVal('action');
     if ($action === "allocate") {
         $this->allocateAddress();
     } elseif ($action === "release") {
         $this->releaseAddress();
     } elseif ($action === "associate") {
         $this->associateAddress();
     } elseif ($action === "disassociate") {
         $this->disassociateAddress();
     } elseif ($action === "addhost") {
         $this->addHost();
     } elseif ($action === "removehost") {
         $this->removeHost();
     } else {
         $this->listAddresses();
     }
 }
	function execute( $par ) {
		global $wgOpenStackManagerNovaAdminKeys;

		if ( !$this->getUser()->isLoggedIn() ) {
			$this->notLoggedIn();
			return;
		}
		$this->userLDAP = new OpenStackNovaUser();
		if ( ! $this->userLDAP->exists() ) {
			$this->noCredentials();
			return;
		}
		$project = $this->getRequest()->getVal( 'project' );
		$userCredentials = $this->userLDAP->getCredentials();
		$this->userNova = new OpenStackNovaController( $userCredentials, $project );
		$adminCredentials = $wgOpenStackManagerNovaAdminKeys;
		$this->adminNova = new OpenStackNovaController( $adminCredentials );

		$action = $this->getRequest()->getVal( 'action' );

		if ( $action == "create" ) {
			if ( ! $this->userLDAP->inProject( $project ) ) {
				$this->notInProject();
				return;
			}
			$this->createInstance();
		} elseif ( $action == "delete" ) {
			if ( ! $this->userLDAP->inProject( $project ) ) {
				$this->notInProject();
				return;
			}
			$this->deleteInstance();
		} elseif ( $action == "configure" ) {
			if ( ! $this->userLDAP->inProject( $project ) ) {
				$this->notInProject();
				return;
			}
			$this->configureInstance();
		} elseif ( $action == "reboot" ) {
			if ( ! $this->userLDAP->inProject( $project ) ) {
				$this->notInProject();
				return;
			}
			$this->rebootInstance();
		} elseif ( $action == "consoleoutput" ) {
			if ( ! $this->userLDAP->inProject( $project ) ) {
				$this->notInProject();
				return;
			}
			$this->getConsoleOutput();
		} else {
			$this->listInstances();
		}
	}
 function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $this->checkTwoFactor();
     $project = $this->getRequest()->getVal('project');
     $region = $this->getRequest()->getVal('region');
     $this->userNova = OpenStackNovaController::newFromUser($this->userLDAP);
     $this->userNova->setProject($project);
     $this->userNova->setRegion($region);
     # ?action=
     $action = $this->getRequest()->getVal('action');
     if ($action === "create") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->createInstance();
     } elseif ($action === "delete") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->deleteInstance();
     } elseif ($action === "configure") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->configureInstance();
     } elseif ($action === "reboot") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->rebootInstance();
     } elseif ($action === "consoleoutput") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->getConsoleOutput();
     } else {
         # Fall back to listing all instances
         $this->listInstances();
     }
 }
 function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $this->checkTwoFactor();
     $project = $this->getRequest()->getVal('project');
     $region = $this->getRequest()->getVal('region');
     $this->userNova = OpenStackNovaController::newFromUser($this->userLDAP);
     $this->userNova->setProject($project);
     $this->userNova->setRegion($region);
     $action = $this->getRequest()->getVal('action');
     if ($action === "create") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->createVolume();
     } elseif ($action === "delete") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->deleteVolume();
     } elseif ($action === "attach") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->attachVolume();
     } elseif ($action === "detach") {
         if (!$this->userLDAP->inProject($project)) {
             $this->notInProject($project);
             return;
         }
         $this->detachVolume();
     } else {
         $this->listVolumes();
     }
 }
 function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $this->checkTwoFactor();
     $project = $this->getRequest()->getVal('project');
     $region = $this->getRequest()->getVal('region');
     $this->userNova = OpenStackNovaController::newFromUser($this->userLDAP);
     $this->userNova->setProject($project);
     $this->userNova->setRegion($region);
     $this->listInstances();
 }
Exemplo n.º 11
0
 function execute($par)
 {
     if (!$this->getUser()->isLoggedIn()) {
         $this->notLoggedIn();
         return;
     }
     $this->userLDAP = new OpenStackNovaUser();
     if (!$this->userLDAP->exists()) {
         $this->noCredentials();
         return;
     }
     $action = $this->getRequest()->getVal('action');
     if ($action == "import") {
         $this->importKey();
     } elseif ($action == "delete") {
         $this->deleteKey();
     } else {
         $this->listKeys();
     }
 }
 /**
  * getUserPermissionsErrors hook
  *
  * @param Title $title
  * @param User $user
  * @param string $action
  * @param $result
  * @return bool
  */
 public static function getUserPermissionsErrors(Title $title, User $user, $action, &$result)
 {
     if (!$title->inNamespace(NS_HIERA)) {
         return true;
     }
     if ($action === 'create' || $action === 'edit') {
         if (!$user->isLoggedIn()) {
             $result = array('openstackmanager-notloggedin');
             return false;
         }
         $userLDAP = new OpenStackNovaUser();
         if (!$userLDAP->exists()) {
             $result = array('openstackmanager-nonovacred-admincreate');
         }
         $project = $title->getText();
         if (!$userLDAP->inRole('projectadmin', $project) && !$user->isAllowed('editallhiera')) {
             $result = array('openstackmanager-hiera-noadmin', $project);
             return false;
         }
     }
     return true;
 }