diff options
| author | michael pereira | 2011-07-18 13:14:19 +0200 |
|---|---|---|
| committer | michael pereira | 2011-07-18 13:14:19 +0200 |
| commit | 83fee3ad5545e3902519cf7cc0fb44d56e881f22 (patch) | |
| tree | 54e846f596486b31c8f4669d0619305200e0bc6c /application/modules/ipxe/controllers | |
| parent | ipxe.lkrn (diff) | |
| download | pbs2-83fee3ad5545e3902519cf7cc0fb44d56e881f22.tar.gz pbs2-83fee3ad5545e3902519cf7cc0fb44d56e881f22.tar.xz pbs2-83fee3ad5545e3902519cf7cc0fb44d56e881f22.zip | |
login fuer ipxe
Diffstat (limited to 'application/modules/ipxe/controllers')
| -rw-r--r-- | application/modules/ipxe/controllers/AuthController.php | 5 | ||||
| -rw-r--r-- | application/modules/ipxe/controllers/IndexController.php | 157 |
2 files changed, 3 insertions, 159 deletions
diff --git a/application/modules/ipxe/controllers/AuthController.php b/application/modules/ipxe/controllers/AuthController.php index 12a897b..ba06456 100644 --- a/application/modules/ipxe/controllers/AuthController.php +++ b/application/modules/ipxe/controllers/AuthController.php @@ -69,8 +69,9 @@ class Ipxe_AuthController extends Zend_Controller_Action $result = "#!ipxe\n"; $result .= "imgfree\n"; - - $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenu/alpha/".$session->getAlphasessionID()." http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$session->getAlphasessionID(); + $result .= "login\n"; + + $result .= "chain http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenu/alpha/".$session->getAlphasessionID()." http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$session->getAlphasessionID(); header("Content-Length: ".(strlen($result))); diff --git a/application/modules/ipxe/controllers/IndexController.php b/application/modules/ipxe/controllers/IndexController.php deleted file mode 100644 index e1211c6..0000000 --- a/application/modules/ipxe/controllers/IndexController.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/* - * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg - * This program is free software distributed under the GPL version 2. - * See http://gpl.openslx.org/ - * - * If you have any feedback please consult http://feedback.openslx.org/ and - * send your suggestions, praise, or complaints to feedback@openslx.org - * - * General information about OpenSLX can be found at http://openslx.org/ - */ - -class Ipxe_IndexController extends Zend_Controller_Action -{ - protected $membership; - - public function init() - { - $this->_helper->layout->disableLayout(); - $this->_helper->viewRenderer->setNoRender(); - - } - - public function errorAction() - { - $result = $this->_request->getParam('serialresult'); - if($result != ""){ - $pbsNotifier = new Pbs_Notifier(); - echo $pbsNotifier->notify('serial',$result); - } - } - - public function indexAction() - { - $mySession = new Zend_Session_Namespace('pbs'); - - if(count($mySession->postdata)<=0){ - $mySession->postdata = $_POST; - } - -// $d = new Pbs_Debug(); -// $d->debug(array('IpxeIndexController',$_SERVER['REMOTE_ADDR'],implode("\t",$mySession->postdata))); - - if(isset($mySession->postdata['serialnumber'])){ - // Create a session - $n = new Pbs_Session(); - - $bootisomapper = new Application_Model_BootIsoMapper(); - $bootiso = new Application_Model_BootIso(); - - $results = $bootisomapper->findBy(array('serialnumber' => $mySession->postdata['serialnumber']),true); - if(count($results) == 0){ - $this->_redirect('/ipxe/index/error/serialresult/noserial2'); - } - $bootiso->setOptions($results[0]); - $bootiso->setID($results[0]['bootisoID']); - $groupID = $bootiso->getGroupID(); - - - - $client = new Application_Model_Client(); - $client->setMacadress($mySession->postdata['mac']); - $client->setGroupID($groupID); - $client->setCreated(time()); - $client = $n->createClient($client); - $clientID = $client->getID(); - - $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); - - if(!isset($_SESSION['alphasessionID'])){ - $session = new Application_Model_Session(); - $session->setBootisoID($bootiso->getID()); - $session->setClientID($clientID); - $session->setTime(time()); - if($this->membership->getID() != ''){ - $session->setMembershipID($this->membership->getID()); - } - $session->setIp($_SERVER['REMOTE_ADDR']); - $session = $n->createSession($session); - $_SESSION['alphasessionID'] = $session->getAlphasessionID(); - } - else{ - $session = new Application_Model_Session(); - $sessionMapper = new Application_Model_SessionMapper(); - $sessions = $sessionMapper->findBy(array('alphasessionID'=>$_SESSION['alphasessionID'])); - $session = $sessions[0]; - } -// // Request Bootmenu -// $pbsFilter = new Pbs_Filter(); -// $bootmenuID = $pbsFilter->evaluate(); -// if($bootmenuID != null){ -// $this->view->alphasessionID = $_SESSION['alphasessionID']; -// // print_a('Debug Output', -// // 'Session is now set', -// // 'Your sessionID is '.$session->getID(), -// // 'Your alphasessionID is '.$session->getAlphasessionID(), -// // 'Your client is '.$session->getClientID(), -// // 'goto bootmenu '.$bootmenuID); -// -// $bootmenuMapper = new Application_Model_BootMenuMapper(); -// $bm = $bootmenuMapper->find($bootmenuID); -// $this->view->title = $bm->getTitle(); -// $this->view->startcounter = $bm->getStartcounter(); -// -// $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); -// $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false); -// $this->view->entries = $res; -// -// } -// else{ -// // print_a('Debug Output', -// // 'Session is now set', -// // 'Your sessionID is '.$session->getID(), -// // 'Your alphasessionID is '.$session->getAlphasessionID(), -// // 'Your client is '.$session->getClientID(), -// // 'there is no bootmenu for you'); -// if (!Zend_Auth::getInstance()->hasIdentity()) { -// $this->view->loginmenu = true; -// $pbsNotifier = new Pbs_Notifier(); -// $this->view->notification = $pbsNotifier->notify("There is no default BootMenu, please Login to get your BootMenu.",'info'); -// } -// else{ -// $pbsNotifier = new Pbs_Notifier(); -// $this->view->notification = $pbsNotifier->notify("You have no BootMenu.",'info'); -// } -// $this->view->nobootmenu = true; -// } - } - else{ - $this->_redirect('/ipxe/index/error/serialresult/noserial'); - } - - } - public function startAction(){ - $bootmenuntryID = $this->_request->getParam('bme'); - $a = $_SESSION['alphasessionID']; - $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); - $bootmenuentry = new Application_Model_BootMenuEntries(); - $bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry); - - $sessionMapper = new Application_Model_SessionMapper(); - $session_k = $sessionMapper->findBy(array('alphasessionID' => $a),true); - - $session = new Application_Model_Session(); - $session->setOptions($session_k[0]); - $session->setID($session_k[0]['sessionID']); - - $session->setBootmenuentryID($bootmenuntryID); - $session->setBootosID($bootmenuentry->getBootosID()); - $sessionMapper->save($session); - - - $this->view->host = 'pbs2.mp.openslx.org'; - $this->view->alphasessionID = $a; - } - -} |
