summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authormichael pereira2011-09-26 02:25:32 +0200
committermichael pereira2011-09-26 02:25:32 +0200
commitc96879951fec2354af5f1c0183a0f941099f0caa (patch)
tree8de146fe1efa9e5970df85d2d187f681b9b2e3cb /application
parentnomembership (diff)
downloadpbs2-c96879951fec2354af5f1c0183a0f941099f0caa.tar.gz
pbs2-c96879951fec2354af5f1c0183a0f941099f0caa.tar.xz
pbs2-c96879951fec2354af5f1c0183a0f941099f0caa.zip
menues ueberarbeitet
Diffstat (limited to 'application')
-rw-r--r--application/models/Session.php10
-rw-r--r--application/models/SessionMapper.php3
-rw-r--r--application/modules/ipxe/controllers/AuthController.php219
-rw-r--r--application/modules/ipxe/controllers/ResourceController.php190
-rw-r--r--application/modules/ipxe/views/scripts/resource/getvesamenu.phtml157
5 files changed, 335 insertions, 244 deletions
diff --git a/application/models/Session.php b/application/models/Session.php
index d8ae306..fa9979a 100644
--- a/application/models/Session.php
+++ b/application/models/Session.php
@@ -19,6 +19,7 @@ class Application_Model_Session
protected $_bootosID;
protected $_bootisoID;
protected $_membershipID;
+ protected $_personID;
protected $_time;
protected $_ip;
protected $_ip6;
@@ -124,6 +125,15 @@ class Application_Model_Session
$this->_membershipID = $_membershipID;
return $this;
}
+ public function getPersonID()
+ {
+ return $this->_personID;
+ }
+ public function setPersonID($_personID)
+ {
+ $this->_personID = $_personID;
+ return $this;
+ }
public function getTime()
{
return $this->_time;
diff --git a/application/models/SessionMapper.php b/application/models/SessionMapper.php
index a9c23c6..3b35ccb 100644
--- a/application/models/SessionMapper.php
+++ b/application/models/SessionMapper.php
@@ -90,6 +90,7 @@ class Application_Model_SessionMapper
'bootosID'=> $session->getBootosID() ,
'bootisoID'=> $session->getBootisoID() ,
'membershipID'=> $session->getMembershipID() ,
+ 'personID'=> $session->getPersonID() ,
'time'=> $session->getTime() ,
'ip'=> $session->getIp() ,
'ip6'=> $session->getIp6() );
@@ -126,6 +127,7 @@ class Application_Model_SessionMapper
->setBootosID($row->bootosID)
->setBootisoID($row->bootisoID)
->setMembershipID($row->membershipID)
+ ->setPersonID($row->personID)
->setTime($row->time)
->setIp($row->ip)
->setIp6($row->ip6);
@@ -145,6 +147,7 @@ class Application_Model_SessionMapper
->setBootosID($row->bootosID)
->setBootisoID($row->bootisoID)
->setMembershipID($row->membershipID)
+ ->setPersonID($row->personID)
->setTime($row->time)
->setIp($row->ip)
->setIp6($row->ip6);
diff --git a/application/modules/ipxe/controllers/AuthController.php b/application/modules/ipxe/controllers/AuthController.php
index 1e2a179..1fdaead 100644
--- a/application/modules/ipxe/controllers/AuthController.php
+++ b/application/modules/ipxe/controllers/AuthController.php
@@ -12,22 +12,30 @@
class Ipxe_AuthController extends Zend_Controller_Action
{
- protected $membership;
-
+ protected $session;
+ protected $sessionMapper;
+ protected $error;
+
public function init()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->db = Zend_Db_Table::getDefaultAdapter();
- }
+ $this->session = new Application_Model_Session();
+ $this->sessionMapper = new Application_Model_SessionMapper();
- public function errorAction()
- {
- $result = $this->_request->getParam('serialresult');
- if($result != ""){
- $pbsNotifier = new Pbs_Notifier();
- echo $pbsNotifier->notify('serial',$result);
+ $alphaID = $this->_request->getParam('alpha');
+
+ if(isset($alphaID)){
+ $alphasessionID = $alphaID;
+ $result = $this->sessionMapper->findBy(array('alphasessionID' => $alphasessionID),true);
+ if(isset($result)){
+ $this->session = $this->session->setOptions($result[0]);
+ $this->session->setID($result[0]['sessionID']);
+ }else{
+ $this->error = "session";
+ }
}
}
@@ -35,62 +43,55 @@ class Ipxe_AuthController extends Zend_Controller_Action
{
$serialnumber = $this->_request->getParam('serialnumber');
$mac = $this->_request->getParam('mac');
- $login = $this->_request->getParam('login') == 'true';
if(isset($serialnumber)){
// Create a session
-
$n = new Pbs_Session();
$bootisomapper = new Application_Model_BootIsoMapper();
$bootiso = new Application_Model_BootIso();
$results = $bootisomapper->findBy(array('serialnumber' => $serialnumber),true);
- if(count($results) == 0){
- $this->_redirect('/ipxe/auth/error/serialresult/noserial');
- }
- $bootiso->setOptions($results[0]);
- $bootiso->setID($results[0]['bootisoID']);
- $groupID = $bootiso->getGroupID();
-
- $client = new Application_Model_Client();
- $client->setGroupID($groupID);
- $client->setMacadress($mac);
- $client->setCreated(time());
- $client = $n->createClient($client);
- $clientID = $client->getID();
-
- $session = new Application_Model_Session();
- $session->setBootisoID($bootiso->getID());
- $session->setClientID($clientID);
- $session->setTime(time());
- $session->setIp($_SERVER['REMOTE_ADDR']);
- $session = $n->createSession($session);
- header('Content-Type: text/plain');
-
- $result = "#!ipxe\n";
- $result .= "imgfree\n";
- if(!$login){
- $result .= "login\n";
- $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/auth/login/alpha/".$session->getAlphasessionID()."/login/true\n";
+ if(isset($results)){
+ $bootiso->setOptions($results[0]);
+ $bootiso->setID($results[0]['bootisoID']);
+ $groupID = $bootiso->getGroupID();
+
+ $client = new Application_Model_Client();
+ $client->setGroupID($groupID);
+ $client->setMacadress($mac);
+ $client->setCreated(time());
+ $client = $n->createClient($client);
+ $clientID = $client->getID();
+
+ $this->session->setBootisoID($bootiso->getID());
+ $this->session->setClientID($clientID);
+ $this->session->setTime(time());
+ $this->session->setIp($_SERVER['REMOTE_ADDR']);
+ $this->session = $n->createSession($this->session);
}else{
- $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$session->getAlphasessionID()."/login/false\n";
+ $this->error = "serial";
}
-
-
- header("Content-Length: ".(strlen($result)));
-
- echo $result;
-
}
else{
-
- $this->_redirect('/ipxe/auth/error/serialresult/noserial');
+ $this->error = "serial";
}
+
+ header('Content-Type: text/plain');
+
+ $result = "#!ipxe\n";
+ $result .= "imgfree\n";
+ if(isset($this->session)){
+ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$this->session->getAlphasessionID()."/error/$this->error\n";
+ }else{
+ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/serialnumer/$serialnumber/mac/$mac/error/$this->error\n";
+ }
+ header("Content-Length: ".(strlen($result)));
+ echo $result;
}
-
+
public function loginAction()
{
$alpha = $this->_request->getParam('alpha');
@@ -98,6 +99,12 @@ class Ipxe_AuthController extends Zend_Controller_Action
if(!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])){
header('WWW-Authenticate: Basic realm=""');
header('HTTP/1.0 401 Unauthorized');
+ header('Content-Type: text/plain');
+ $result = "#!ipxe\n";
+ $result .= "imgfree\n";
+ $result .= "login\n";
+ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://\${username:uristring}:\${password:uristring}@".$_SERVER['HTTP_HOST']."/ipxe/auth/login/alpha/".$alpha."\n";
+ header("Content-Length: ".(strlen($result)));
exit;
}
@@ -111,21 +118,109 @@ class Ipxe_AuthController extends Zend_Controller_Action
$result = $auth->authenticate($adapter);
- if ($result->isValid()) {
- $personmapper = new Application_Model_PersonMapper();
- $result = $personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- $personmapper->save($person);
-
- $this->_redirect("/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/person/".$person->getID()."/login/true");
- return;
- } else {
- echo "Wrong Email or Password.";
- }
+ if (isset($this->session)){
+ if ($result->isValid()) {
+
+ $personmapper = new Application_Model_PersonMapper();
+ $result = $personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
+ $person = new Application_Model_Person($result[0]);
+ $person->setID($result[0]['personID']);
+ $date = new DateTime();
+ $person->setLogindate($date->getTimestamp());
+ $personmapper->save($person);
+
+ $this->session->setPersonID($person->getID());
+ $this->sessionMapper->save($this->session);
+
+ } else {
+ $this->error = "login";
+ }
+ }else{
+ $this->error = "session";
+ }
+
+ header('Content-Type: text/plain');
+
+ $result = "#!ipxe\n";
+ $result .= "imgfree\n";
+ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/$this->error\n";
+
+ header("Content-Length: ".(strlen($result)));
+
+ echo $result;
}
+
+ public function logoutAction(){
+
+ $alpha = $this->_request->getParam('alpha');
+
+ if (isset($this->session)){
+ $this->session->setPersonID(null);
+ $this->session->setMembershipID(null);
+ $this->sessionMapper->save($this->session);
+ }else{
+ $this->error = "session";
+ }
+
+ header('Content-Type: text/plain');
+
+ $result = "#!ipxe\n";
+ $result .= "imgfree\n";
+ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/$this->error\n";
+ header("Content-Length: ".(strlen($result)));
+
+ echo $result;
+ }
+
+ public function switchgroupAction(){
+
+ $alpha = $this->_request->getParam('alpha');
+
+ if (isset($this->session)){
+ $this->session->setMembershipID(null);
+ $this->sessionMapper->save($this->session);
+ }else{
+ $this->error = "session";
+ }
+
+ header('Content-Type: text/plain');
+
+ $result = "#!ipxe\n";
+ $result .= "imgfree\n";
+ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/$this->error\n";
+
+ header("Content-Length: ".(strlen($result)));
+
+ echo $result;
+ }
+
+ public function setgroupAction(){
+
+ $alpha = $this->_request->getParam('alpha');
+ $membershipID = $this->_request->getParam('membershipid');
+
+ //TODO test if member of group
+ if (isset($this->session)){
+ $this->session->setMembershipID($membershipID);
+ $this->sessionMapper->save($this->session);
+ }else{
+ $this->error = "session";
+ }
+
+ header('Content-Type: text/plain');
+
+ $result = "#!ipxe\n";
+ $result .= "imgfree\n";
+ $result .= "chain http://".$_SERVER['HTTP_HOST']."/ipxe/vesamenu.c32 http://".$_SERVER['HTTP_HOST']."/ipxe/resource/getvesamenuconfig/alpha/".$alpha."/error/$this->error\n";
+
+ header("Content-Length: ".(strlen($result)));
+
+ echo $result;
+ }
+
+
+
+
}
diff --git a/application/modules/ipxe/controllers/ResourceController.php b/application/modules/ipxe/controllers/ResourceController.php
index 00b5f29..44e45b2 100644
--- a/application/modules/ipxe/controllers/ResourceController.php
+++ b/application/modules/ipxe/controllers/ResourceController.php
@@ -13,7 +13,7 @@
class Ipxe_ResourceController extends Zend_Controller_Action
{
- private $thisSession;
+ private $session;
public function init()
{
@@ -21,109 +21,69 @@ class Ipxe_ResourceController extends Zend_Controller_Action
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
- $session = new Application_Model_Session();
- $sm = new Application_Model_SessionMapper();
+ $this->session = new Application_Model_Session();
+ $sessionMapper = new Application_Model_SessionMapper();
//TODO Error Messages if something failed
$alphaID = $this->_request->getParam('alpha');
-
- if($alphaID != ""){
+
+ if(isset($alphaID)){
$alphasessionID = $alphaID;
- $result = $sm->findBy(array('alphasessionID' => $alphasessionID),true);
+ $result = $sessionMapper->findBy(array('alphasessionID' => $alphasessionID),true);
# print_a($result);
- $this->thisSession = $session->setOptions($result[0]);
- $this->thisSession->setID($result[0]['sessionID']);
+ $this->session = $this->session->setOptions($result[0]);
+ $this->session->setID($result[0]['sessionID']);
}
$bootmenuntryID = $this->_request->getParam('bme');
- if(isset($bootmenuntryID)){
+ if(isset($bootmenuntryID) && isset($this->session)){
+ //TODO check if allowed
$bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
$bootmenuentry = new Application_Model_BootMenuEntries();
$bootmenuentriesMapper->find($bootmenuntryID,$bootmenuentry);
-
- $sessionMapper = new Application_Model_SessionMapper();
-
- $this->thisSession->setBootmenuentryID($bootmenuntryID);
- $this->thisSession->setBootosID($bootmenuentry->getBootosID());
- $sessionMapper->save($this->thisSession);
+
+ $this->session->setBootmenuentryID($bootmenuntryID);
+ $this->session->setBootosID($bootmenuentry->getBootosID());
+ $sessionMapper->save($this->session);
}
}
- public function getvesamenuAction(){
- if(is_dir("../resources/ipxe/")){
-
- header('Content-Type: application/octet-stream');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="vesamenu.c32"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- chdir("../resources/ipxe/");
-
- header("Content-Length: ".filesize(getcwd()."/vesamenu.c32"));
-
- passthru( "cat vesamenu.c32");
- }else{
- header('HTTP/1.0 404 Not Found');
- }
-
- }
-
- public function getpxelinuxAction(){
- if(is_dir("../resources/ipxe/")){
-
- header('Content-Type: application/octet-stream');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="pxelinux.0"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- chdir("../resources/ipxe/");
-
- header("Content-Length: ".filesize(getcwd()."/pxelinux.0"));
-
- passthru( "cat pxelinux.0");
- }else{
- header('HTTP/1.0 404 Not Found');
- }
-
- }
-
public function getvesamenuconfigAction(){
-
-// $membershipMapper = new Application_Model_MembershipMapper();
-// $memberships = $membershipMapper->findBy(array("personID" => $person->getID()),true);
-//
+ header('Content-Type: text/html');
+ $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
+ header('Content-Disposition: ' . $content_disp . '; filename="vesamenu.conf"');
+ header('Pragma: no-cache');
+ header('Expires: 0');
+
+ $vesamenuView = new Zend_View();
+ $vesamenuView->addScriptPath(APPLICATION_PATH.'/modules/ipxe/views/scripts/resource/');
-
- header('Content-Type: text/html');
- $content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
- header('Content-Disposition: ' . $content_disp . '; filename="vesamenu.conf"');
- header('Pragma: no-cache');
- header('Expires: 0');
-
- $vesamenuView = new Zend_View();
- $vesamenuView->addScriptPath(APPLICATION_PATH.'/modules/ipxe/views/scripts/resource/');
+ $vesamenuView->host = $_SERVER['HTTP_HOST'];
+ $vesamenuView->error = $this->_request->getParam('error');
- $vesamenuView->host = $_SERVER['HTTP_HOST'];
-
- $login = $this->_request->getParam('login') == 'true';
+ if (isset($this->session)){
+ $vesamenuView->alphaID = $this->session->getAlphasessionID();
- if($login){
-
- $person = $this->_request->getParam('person');
- if (isset($person)) {
- $this->membershipMapper = new Application_Model_MembershipMapper();
- $this->memberships = $this->membershipMapper->findBy(array("personID" => $person),true);
- }
- $this->memberships = null;
+ if ($this->session->getPersonID() != null){
+ $personMapper = new Application_Model_PersonMapper();
+ $person = $personMapper->find($this->session->getPersonID());
+ $vesamenuView->name = $person->getName();
+ $vesamenuView->firstname = $person->getFirstname();
+ $vesamenuView->loggedin = true;
+ }else{
+ $vesamenuView->loggedin = false;
+ }
+
+ if ($this->session->getPersonID() != null && $this->session->getMembershipID() == null ){
$groupMapper = new Application_Model_GroupMapper();
$roleMapper = new Application_Model_RoleMapper();
- if(isset($this->memberships)) {
-
- foreach($this->memberships as $membership) {
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $memberships = $membershipMapper->findBy(array('personID' => $this->session->getPersonID()),true);
+
+ if(isset($memberships)) {
+ foreach($memberships as $membership) {
$group = $groupMapper->find($membership['groupID']);
$role = $roleMapper->find($membership['roleID']);
$membershipList[] = array(
@@ -132,47 +92,53 @@ class Ipxe_ResourceController extends Zend_Controller_Action
'role' => $role->getTitle()
);
}
+ $vesamenuView->memberships = $membershipList;
+ }else{
+ $vesamenuView->memberships = null;
}
$vesamenuView->action = "selectmembership";
- $vesamenuView->memberships = $membershipList;
+
+ }
- }else{
- $vesamenuView->login = $login;
- $_SESSION['alphasessionID'] = $this->thisSession->getAlphasessionID();
- // Request Bootmenu
- $pbsFilter = new Pbs_Filter();
- $bootmenuID = $pbsFilter->evaluate();
-
- if($bootmenuID != null){
- $vesamenuView->alphaID = $this->thisSession->getAlphasessionID();
+ // Request Bootmenu
+ $_SESSION['alphasessionID'] = $this->session->getAlphasessionID();
+ $pbsFilter = new Pbs_Filter();
+ $bootmenuID = $pbsFilter->evaluate();
- $bootmenuMapper = new Application_Model_BootMenuMapper();
- $bm = $bootmenuMapper->find($bootmenuID);
- $vesamenuView->title = $bm->getTitle();
- // $this->view->startcounter = $bm->getStartcounter();
-
- $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
- $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
- $vesamenuView->bmelist = $res;
-
- }
- else{
+ if($bootmenuID != null){
+ $bootmenuMapper = new Application_Model_BootMenuMapper();
+ $bm = $bootmenuMapper->find($bootmenuID);
+ $vesamenuView->title = $bm->getTitle();
+ $vesamenuView->startcounter = $bm->getStartcounter();
- $vesamenuView->error = "You have no BootMenu.";
- }
+ $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper();
+ $res = $bootmenuentriesMapper->findBy(array('bootmenuID' => $bootmenuID),false);
+ $vesamenuView->bmelist = $res;
+ }else{
+ $vesamenuView->bmelist = null;
}
-
- $vesamenu = $vesamenuView->render('getvesamenu.phtml');
+ }else{
+ $vesamenuView->serialnumber = $this->_request->getParam('serialnumber');
+ $vesamenuView->mac = $this->_request->getParam('mac');
+ if($vesamenuView->error == "serial"){
+ $vesamenuView->error = "serial";
+ }else{
+ $vesamenuView->error = "session";
+ }
+ }
+
+ $vesamenu = $vesamenuView->render('getvesamenu.phtml');
+
+ header("Content-Length: ".(strlen($vesamenu)));
- header("Content-Length: ".(strlen($vesamenu)));
-
- echo $vesamenu;
+ echo $vesamenu;
}
public function getkernelAction(){
- $bootosID = $this->thisSession->getBootosID();
+ //TODO session & bme error
+ $bootosID = $this->session->getBootosID();
if(is_dir("../resources/bootos/$bootosID/kernel/") && is_numeric($bootosID)){
@@ -197,7 +163,7 @@ class Ipxe_ResourceController extends Zend_Controller_Action
public function getinitramfsAction()
{
- $bootosID = $this->thisSession->getBootosID();
+ $bootosID = $this->session->getBootosID();
if(is_dir("../resources/bootos/$bootosID/initramfs/") && is_numeric($bootosID)){
diff --git a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
index 776a810..7755c54 100644
--- a/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
+++ b/application/modules/ipxe/views/scripts/resource/getvesamenu.phtml
@@ -23,6 +23,12 @@
echo " append ".$args."\n";
}
+ function comment ( $label, $labelmenu) {
+ echo "label $label\n";
+ echo " menu label $labelmenu\n";
+ echo " menu disable\n";
+ }
+
function localboot () {
label ( "LOCALBOOT");
echo "LOCALBOOT -1\n";
@@ -37,32 +43,32 @@
}
function nomembership () {
- echo "label failed\n";
- echo " menu label You have no memberships\n";
- echo " menu disable\n";
- uriboot ( "Return to Group Bootmenu", "/ipxe/auth/serial/serialnumber/55-44-33-22-11/mac/123/login/false", "" );
+ comment ("failed", "You have no memberships");
+ uriboot ( "Return to Group Bootmenu", "/ipxe/auth/logout/alpha/$this->alphaID", "" );
}
function retry () {
- echo "label failed\n";
- echo " menu label Authentication Failed\n";
- echo " menu disable\n";
- uriboot ( "Try again", "/ipxe/auth/serial/serialnumber/55-44-33-22-11/mac/123/login/true", "" );
- uriboot ( "Return to Group Bootmenu", "/ipxe/auth/serial/serialnumber/55-44-33-22-11/mac/123/login/false", "" );
+ comment ("failed", "Authentication Failed");
+ uriboot ( "Try again", "/ipxe/auth/login/alpha/$this->alphaID", "" );
+ uriboot ( "Return to Group Bootmenu", "/ipxe/auth/logout/alpha/$this->alphaID", "" );
+ }
+
+ function sessionerror () {
+ comment ("failed", "A Session Error occured");
+ uriboot ( "Reconnect", "/ipxe/auth/serial/serialnumber/$this->serialnumber/mac/$this->mac", "" );
+ }
+
+ function serialerror () {
+ comment ("failed", "The Serial was not found. Press Tab to change the Serial or contact an Admin");
+ uriboot ( "Reconnect", "/ipxe/auth/serial/serialnumber/$this->serialnumber/mac/$this->mac", "" );
}
- function authenticated ($username, $password) {
-
- switch ( "$username:$password" ) {
- case "test:test":
- case "guest:guest":
- return 1;
- default:
- return 0;
- }
+ function nobootmenu () {
+ comment ("failed", "There are no Bootmenu Entries");
}
- ?>
+?>
+
TIMEOUT 100
PROMPT 0
@@ -101,56 +107,67 @@ menu color sel 7;37;40 #ff1c2a33 #667799bb all
#menu color help 37;40 #ff1c2a33 #00000000 none
MENU MSGCOLOR #ff1c2a33 #00000000 none
- <?
-// if(!isset($this->error)){
-// title ( $this->title );
-// }else{
-// title($this->error);
-// }
-
- if($this->action == "selectmembership"){
- title ( "Select Membership:" );
- if(isset($this->memberships)){
- foreach($this->memberships as $membership){
- uriboot ($membership['group']." as ".$membership['role'], 'test', 'test');
- }
-
- }else{
- nomembership();
- }
-
+<?php
+
+ if(isset($this->error)){
+ switch($this->error){
+ case "serial":
+ serialerror();
+ break;
+ case "session":
+ sessionerror();
+ break;
+ case "login":
+ retry();
+ break;
+ }
+ }else{
+
+ if($this->action == "selectmembership"){
+ title ( "Select Membership:" );
+ if(isset($this->memberships)){
+ foreach($this->memberships as $membership){
+ uriboot ($membership['group']." as ".$membership['role'], "/ipxe/auth/setgroup/membershipid/".$membership['membershipID']."/alpha/$this->alphaID", '');
+ }
+ uriboot ( "Return to Group Bootmenu", "/ipxe/auth/logout/alpha/$this->alphaID", "" );
+ }else{
+ nomembership();
+ }
+ }else{
+
+ title ( $this->title );
+
+ $bootosmapper = new Application_Model_BootOsMapper();
+
+ if(isset($this->bmelist)){
+ foreach($this->bmelist as $bme){
+
+ $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl();
+
+ if($bme->getKcl() && $kcl != null){
+ uriboot ( $bme->getTitle(),
+ "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs $kcl alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
+ }else{
+ uriboot ( $bme->getTitle(),
+ "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
+ }
+ }
+ }else{
+ nobootmenu();
+ }
+
+ comment ("info", "More Options:");
+
+ if(!$this->loggedin){
+ uriboot ( "Login", "/ipxe/auth/login/alpha/$this->alphaID", "" );
+ texthelp("Login to get your own Bootmenu.");
+ }else{
+ uriboot ( "Switch Group From $this->group", "/ipxe/auth/switchgroup/alpha/$this->alphaID", "" );
+ uriboot ( "Return to Group Bootmenu $this->group", "/ipxe/auth/logout/alpha/$this->alphaID", "" );
+ }
+
+ localboot();
+ }
}
-
-// if (!$this->login) {
-// retry();
-// } else {
-//
-// $bootosmapper = new Application_Model_BootOsMapper();
-//
-// if(isset($this->bmelist)){
-// foreach($this->bmelist as $bme){
-//
-// $kcl = $bootosmapper->find($bme->getBootosID())->getDefaultkcl();
-//
-// if($bme->getKcl() && $kcl != null){
-// uriboot ( $bme->getTitle(),
-// "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs $kcl alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
-// }else{
-// uriboot ( $bme->getTitle(),
-// "http://$this->host/ipxe/resource/getkernel/alpha/$this->alphaID/bme/".$bme->getID()."/file/kernel", "initrd=http://$this->host/ipxe/resource/getinitramfs/alpha/$this->alphaID/bme/".$bme->getID()."/file/initramfs alpha=$this->alphaID file=http://$this->host/c/$this->alphaID/default.tgz ".$bme->getKclappend());
-// }
-// }
-// if($this->login)
-// uriboot ( "Return to Group Bootmenu", "/ipxe/auth/serial/serialnumber/55-44-33-22-11/mac/123/login/false", "" );
-// }
-//
-// if(!$this->login){
-// uriboot ( "Login", "/ipxe/auth/serial/serialnumber/55-44-33-22-11/mac/123/login/true", "" );
-// texthelp("Login to get your own Bootmenu.");
-// }
-//
-// localboot();
-// }
-
- ?> \ No newline at end of file
+?> \ No newline at end of file