/modules-available/eventlog/

1698d52d179e2'/> Web Interface zum Verwalten der Hochschul-/UniSpezifischen Einstellungen der Linux-UmgebungOpenSLX
summaryrefslogblamecommitdiffstats
path: root/modules-available/serversetup-bwlp-ipxe/page.inc.php
blob: 40b75dd2362ed1db3c98c73e641e61fa39bab651 (plain) (tree)
1
2
3
4
5
6
7
8
9



                                   
 

                                    
                                
                             
                                  
 













                                                                                                                      


                                         
 
                                          
                                                                

                                                   
 

                                                            


                                                








                                                                        

                                                               


                                                                


                                                          

                                                               



                                                    
 




                                                                      
                                                    
                                                                      


                                                 




                                                                 





                                                        




                                                                      




                                                                      
                                               
                                                


                                            




                                                                    




                                                          
 
                              
                                                            
                                                                                                                        

                                                                 
                                                                                                                                  


                                                                                                                              
                                     



                                                                                                                                


                                                                                                                                  
                                                                 

                                                                                                                            



                                                                   

                                                                                   



                                                                



                                     
                                               
 









                                                                                                                            
                                 
                                                                                                                      
                         

                 
                                
                                     
                                                                   













                                                                 



                                                                      



                                                               



                                                  



                                                                   



                                                                      







                                                          























                                                                                             
                                                                                                          






                                                                             

                                                                                          





                                                                                                  

         
                                                          
         







                                                                                               






                                              
                                                   



                                                                                        
                                                                                                                  






                                                                                      
                                                                          
                                                                                                










                                                        




                                                   


                                                                        
 

                                                                                                                                             
                                                                                  
                                                             
                                                        
 
                                             



                                                                                                         
                                                     





                                                                                                                                 


                                                                         

                                                            
                                                  


                   





                                                                                                           




                                                                                                                             
                                                      
                                                 
                                





                                                                              
                                                                                                                             

                                                                                           


                                            
                                                       
                                                  
                                                                                    
                   












                                                                                                                 
                 





                                                       
                                            
                                
                                                                                                                
                                                                                  








                                                       


                                                                    
                 
                                                                        
                                                                                    


                                                       
                 



                                                                
                                                                    
                                      
                                                                                                                                    
                                                                                                       
                                                              


                                                                                     




                                                             
                                                                                                                  
                                                 
                                                                                                                                        
                                                        
                                                                                                                                       
                  
                                                             




                                                                                                                          
                                         

                                                               
                                                                

                                                                          







                                                                                                                              





                                                                                                                                  
                                                          
                                                                                  
                                 
                         
                 

                                                                                                 
                                                                
                 
 





                                                                                 







                                                                 





                                                                                                           
                                                                                                                            




                                                                             





























                                                                                                                                           
                         
                                                         

                                                                                             
                                                                     
                         


                                                            






                                                            

                                                                            
                                                   

                                                                         


                                                                                                               
                 
 
                                                                                                   
                                                                    
         
 


                                                       
                                                                          
                                                                                         
                                                                                            


                   



                                                                                                          
                                                                                         
 

                                                                         
                                     
                 
 

                                                                                                         

                 

                                                                                                                     
                                     
                 
 
                                  

                                                                                        
                                                                                                                                                                
                                                                                      



                                                                    
                                                       



                                                
                                                                                                

                            
 

                                          




                                                                                




                                                                                            
                                                                 

         










                                                                                                                



                                                              
                                                                                

                               

                                                                                   



                                                                                                              

         






                                                                              
 




                                                                                                  
                                                                                                                                                   

                                                                         
                                                                     
                                               
                                                            
                                              
                                                                          

                                       


                                                                                                          
                 
 

                                                                  

                                                                                      
 


                                                                
                                                                                                          



                                                    
                                                          


                                                          
                                  
                                           

                                                            


                                                                                             
                                  

                                                                   

                                                    





                                                                                            



                                                                                                                       
                                                                                                    



                                                                                       
                                 
                                                       


                                                                                                                                                                  





                                                                                                          
                                                                                                                                                               

                                                                                                               

                                                                                                

                                                                                                                                                    

                                                                                   


                                                                                                                                                                          








                                                                                                                                                       
                                         
                                 



                                                                                                                          
                         








                                                                                                                                                  
 


                                                  

                                             
                                                                    
                               
                                                                             



                                                        
                 

                                                           
                                                          



                                                                     
         
 







                                                                  
                                                                                                                                



                                









                                                                           
                                                                    

                               
                                
                                                               











                                                                                 
                        













                                                                                                



                                                                        

                                             



                                         

                                                                                                                 



                                                                          

                                                                                                                            
                                                                  

                                                                          
                                                                 

         
















                                                                                                     
                                                                        
                                             



























































                                                                                                                                                                         

                                        







                                                                                    

                               
                                                     

                                                                       

                                                          
                                         
                                                                                                  







                                                                                                    
                         



                                                                                                    




                                                                 













                                                                             
                                                                











                                                                                          
 
<?php

class Page_ServerSetup extends Page
{

	private $addrListTask;
	private $compileTask = null;
	private $currentAddress;
	private $currentMenu;
	private $hasIpSet = false;

	private function getCompileTask()
	{
		if ($this->compileTask !== null)
			return $this->compileTask;
		$this->compileTask = Property::get('ipxe-task-id');
		if ($this->compileTask !== false) {
			$this->compileTask = Taskmanager::status($this->compileTask);
			if (!Taskmanager::isTask($this->compileTask) || Taskmanager::isFinished($this->compileTask)) {
				$this->compileTask = false;
			}
		}
		return $this->compileTask;
	}

	protected function doPreprocess()
	{
		User::load();

		if (!User::isLoggedIn()) {
			Message::addError('main.no-permission');
			Util::redirect('?do=Main');
		}

		if (Request::any('action') === 'getimage') {
			User::assertPermission("download");
			$this->handleGetImage();
		}

		$this->currentMenu = Property::getBootMenu();

		$action = Request::post('action');

		if ($action === false) {
			$this->currentAddress = Property::getServerIp();
			$this->getLocalAddresses();
		}

		if ($action === 'compile') {
			User::assertPermission("edit.address");
			if ($this->getCompileTask() === false) {
				Trigger::ipxe();
			}
			Util::redirect('?do=serversetup');
		}

		if ($action === 'ip') {
			User::assertPermission("edit.address");
			// New address is to be set
			$this->getLocalAddresses();
			$this->updateLocalAddress();
		}

		if ($action === 'savebootentry') {
			User::assertPermission('ipxe.bootentry.edit');
			$this->saveBootEntry();
		}

		if ($action === 'deleteBootentry') {
			User::assertPermission('ipxe.bootentry.edit');
			$this->deleteBootEntry();
		}

		if ($action === 'savemenu') {
			User::assertPermission('ipxe.menu.edit');
			$this->saveMenu();
		}

		if ($action === 'savelocation') {
			// Permcheck in function
			$this->saveLocationMenu();
			Util::redirect('?do=locations');
		}

		if ($action === 'savelocalboot') {
			User::assertPermission('ipxe.localboot.edit');
			$this->saveLocalboot();
		}

		if ($action === 'import') {
			User::assertPermission('ipxe.bootentry.edit');
			$this->execImportPxeMenu();
		}

		if ($action === 'deleteMenu') {
			// Permcheck in function
			$this->deleteMenu();
		}

		if ($action === 'setDefaultMenu') {
			User::assertPermission('ipxe.menu.edit', 0);
			$this->setDefaultMenu();
		}

		if (Request::isPost()) {
			Util::redirect('?do=serversetup');
		}

		User::assertPermission('access-page');

		$addr = false;
		if (User::hasPermission('ipxe.menu.view')) {
			Dashboard::addSubmenu('?do=serversetup&show=menu', Dictionary::translate('submenu_menu', true));
		}
		if (User::hasPermission('ipxe.bootentry.view')) {
			Dashboard::addSubmenu('?do=serversetup&show=bootentry', Dictionary::translate('submenu_bootentry', true));
		}
		if (User::hasPermission('edit.address')) {
			Dashboard::addSubmenu('?do=serversetup&show=address', Dictionary::translate('submenu_address', true));
			$addr = true;
		}
		if (User::hasPermission('download')) {
			Dashboard::addSubmenu('?do=serversetup&show=download', Dictionary::translate('submenu_download', true));
		}
		if (User::hasPermission('ipxe.localboot.*')) {
			Dashboard::addSubmenu(