diff options
author | Simon | 2011-03-18 18:49:30 +0100 |
---|---|---|
committer | Simon | 2011-03-18 18:49:30 +0100 |
commit | 5139008cee049b2ab24b870a263996fe9043adeb (patch) | |
tree | a79c36fce9afc587c73cd4e71c94e72bbc83830e | |
parent | Ansicht von Pools geändert (diff) | |
download | pbs2-5139008cee049b2ab24b870a263996fe9043adeb.tar.gz pbs2-5139008cee049b2ab24b870a263996fe9043adeb.tar.xz pbs2-5139008cee049b2ab24b870a263996fe9043adeb.zip |
User-Oberfläche, FBGui-Oberfläche legt Session&Clients an - für Kiosk-System
apache-default zum ersetzen, damit server von außen erreichbar ist
FilterController weitergearbeitet
20 files changed, 462 insertions, 25 deletions
diff --git a/.zfproject.xml b/.zfproject.xml index 22ccca6..90d4d20 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -252,6 +252,12 @@ </controllerFile> <controllerFile controllerName="Filter"> <actionMethod actionName="index"/> + <actionMethod actionName="addfilter"/> + <actionMethod actionName="removefilter"/> + <actionMethod actionName="editfilter"/> + <actionMethod actionName="addfilterentry"/> + <actionMethod actionName="editfilterentry"/> + <actionMethod actionName="removefilterentry"/> </controllerFile> <controllerFile controllerName="Pool"> <actionMethod actionName="index"/> @@ -267,6 +273,7 @@ <formFile formName="Client"/> <formFile formName="Pool"/> <formFile formName="PoolClient"/> + <formFile formName="Filter"/> </formsDirectory> <layoutsDirectory enabled="false"/> <modelsDirectory> @@ -334,6 +341,24 @@ <viewControllerScriptsDirectory forControllerName="Pool"> <viewScriptFile forActionName="unlinkclient"/> </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Filter"> + <viewScriptFile forActionName="addfilter"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Filter"> + <viewScriptFile forActionName="removefilter"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Filter"> + <viewScriptFile forActionName="editfilter"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Filter"> + <viewScriptFile forActionName="addfilterentry"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Filter"> + <viewScriptFile forActionName="editfilterentry"/> + </viewControllerScriptsDirectory> + <viewControllerScriptsDirectory forControllerName="Filter"> + <viewScriptFile forActionName="removefilterentry"/> + </viewControllerScriptsDirectory> </viewScriptsDirectory> <viewHelpersDirectory/> <viewFiltersDirectory/> diff --git a/apache-default b/apache-default new file mode 100644 index 0000000..95d0580 --- /dev/null +++ b/apache-default @@ -0,0 +1,36 @@ +<VirtualHost *:80> + ServerAdmin webmaster@localhost + +DocumentRoot /tmp/pbs2/public + <Directory /tmp/pbs2/public > + Options FollowSymLinks + AllowOverride All + </Directory> + + + ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ + <Directory "/usr/lib/cgi-bin"> + AllowOverride None + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch + Order allow,deny + Allow from all + </Directory> + + ErrorLog /var/log/apache2/error.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + CustomLog /var/log/apache2/access.log combined + + Alias /doc/ "/usr/share/doc/" + <Directory "/usr/share/doc/"> + Options Indexes MultiViews FollowSymLinks + AllowOverride None + Order deny,allow + Deny from all + Allow from 127.0.0.0/255.0.0.0 ::1/128 + </Directory> + +</VirtualHost> diff --git a/application/controllers/IndexController.php b/application/controllers/IndexController.php index df2f91c..9a65853 100644 --- a/application/controllers/IndexController.php +++ b/application/controllers/IndexController.php @@ -6,6 +6,17 @@ class IndexController extends Zend_Controller_Action public function init() { /* Initialize action controller here */ + if(stristr($_SERVER['HTTP_USER_AGENT'],'prebootGUI')){ + $redirector = $this->_helper->getHelper('Redirector'); + $redirector->gotoSimple('index', + 'Index', + 'fbgui', + array('keys' => array_keys($_POST), + 'post' => $_POST + ) + ); + + } } public function indexAction() diff --git a/application/modules/dev/controllers/FilterController.php b/application/modules/dev/controllers/FilterController.php index b346810..53900b3 100644 --- a/application/modules/dev/controllers/FilterController.php +++ b/application/modules/dev/controllers/FilterController.php @@ -10,12 +10,11 @@ class dev_FilterController extends Zend_Controller_Action public function init() { try{ - - $this->_filtermapper = new Application_Model_FilterMapper(); - }catch (Zend_Exception $e) { - echo "Error message 1: " . $e->getMessage() . "\n"; - } - $this->db = Zend_Db_Table::getDefaultAdapter(); + $this->_filtermapper = new Application_Model_FilterMapper(); + }catch (Zend_Exception $e) { + echo "Error message 1: " . $e->getMessage() . "\n"; + } + $this->db = Zend_Db_Table::getDefaultAdapter(); } public function indexAction() diff --git a/application/modules/fbgui/controllers/IndexController.php b/application/modules/fbgui/controllers/IndexController.php index 685feaa..238edb7 100644 --- a/application/modules/fbgui/controllers/IndexController.php +++ b/application/modules/fbgui/controllers/IndexController.php @@ -9,17 +9,44 @@ class Fbgui_IndexController extends Zend_Controller_Action } public function indexAction() - { - // action body - - // Call this Procedure after Login to create a session and save the alphasessionID to session - $n = new Pbs_Session(); - $session = new Application_Model_Session(); - $session->setBootisoID(1); - $session->setTime(time()); - $session->setIp($_SERVER['REMOTE_ADDR']); - $session = $n->createsession($session); - $_SESSION['alphasessionID'] = $session->getAlphasessionID(); + { + if(isset($this->_request->getParam('post')) && $this->_request->getParam('keys')){ + $data = $this->_request->getParam('post'); + $keys = $this->_request->getParam('keys'); + $_POST = array_combine ( $keys , $data ); + } + if(isset($_POST['bootisoID'])){ + // Create a session + $n = new Pbs_Session(); + + $bootisomapper = new Application_Model_BootIsoMapper(); + $bootiso = new Application_Model_BootIso(); + $bootisomapper->find($_POST['bootisoID'],$bootiso); + $groupID = $bootiso->getGroupID(); + + $client = new Application_Model_Client(); + $client->setMacadress($_POST['mac']); + $client->setHardwarehash($_POST['hardwarehash']); + $client->setGroupID($groupID); + $client = $n->createClient($client); + $clientID = $client->getID(); + + $session = new Application_Model_Session(); + $session->setBootisoID($_POST['bootisoID']); + $session->setClientID($clientID); + $session->setTime(time()); + $session->setIp($_SERVER['REMOTE_ADDR']); + $session = $n->createSession($session); + $_SESSION['alphasessionID'] = $session->getAlphasessionID(); + echo "<h1>Welcome</h1>"; + print_a('Session is now set','Your alphasessionID is '.$session->getAlphasessionID()); + $this->_redirect('/dev/bootmenu/index/bootmenuid/1'); + } + else{ + echo "<h1>Not Welcome</h1>"; + print_a($_POST); + } + die(); } diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index d40e1b1..4bb2b35 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -5,6 +5,10 @@ class User_ClientController extends Zend_Controller_Action private $membership; public function init() { + if($_SESSION['membershipID'] ==''){ + $pbsNotifier = new Pbs_Notifier(); + echo $pbsNotifier->notify('No membershipID set','forbidden'); + } /* Initialize action controller here */ $membershipMapper = new Application_Model_MembershipMapper(); $this->membership = new Application_Model_Membership(); diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index 2704309..8ceefe3 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -2,13 +2,100 @@ class User_FilterController extends Zend_Controller_Action { - + protected $filterMapper; + protected $membershipMapper; public function init() { - /* Initialize action controller here */ + if($_SESSION['membershipID'] ==''){ + $pbsNotifier = new Pbs_Notifier(); + echo $pbsNotifier->notify('No membershipID set','forbidden'); + } + $this->filterMapper = new Application_Model_FilterMapper(); + + $membershipMapper = new Application_Model_MembershipMapper(); + $this->membership = new Application_Model_Membership(); + $membershipMapper->find($_SESSION['membershipID'],$this->membership); + + $this->db = Zend_Db_Table::getDefaultAdapter(); } public function indexAction() + { + // TODO: ACL: is he authorized to see this? + + $result = $this->_request->getParam('addresult'); + if($result != ""){ + $pbsNotifier = new Pbs_Notifier(); + $this->view->notification = $pbsNotifier->notify('create',$result); + } + + $filters = $this->filterMapper->findBy('groupID',$this->membership->getGroupID()); + foreach($filters as $filter){ + $ff = new Application_Model_Filter(); + $ff->setOptions($filter); + $ff->setID($filter['filterID']); + $allFilter[] = $ff; + } + $this->view->filters = $allFilter; + } + + public function addfilterAction() + { + // TODO: ACL: is he authorized to add a filter? + $bmmapper = new Application_Model_BootMenuMapper(); + $result = $bmmapper->findBy('groupID',$this->membership->getGroupID()); + foreach($result as $rr){ + $bm = new Application_Model_BootMenu(); + $bm->setOptions($rr); + $bm->setID($rr['bootmenuID']); + $bootmenus[] = $bm; + } + $this->view->bootmenus = $bootmenus; + + if (!isset($_POST["add"])){ + $addfilterform = new user_Form_Filter(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus)); + $this->view->addfilterform = $addfilterform; + }else { + $addfilterform = new user_Form_Filter(array('buttontext' => 'Create Filter','bootmenus'=>$bootmenus),$_POST); + if ($addfilterform->isValid($_POST)) { + try{ + $newfilter = new Application_Model_Filter($_POST); + $newfilter->setCreated(time()); + $newfilter->setGroupID($this->membership->getGroupID()); + $newfilter->setMembershipID($this->membership->getID()); + $newfilter2 = new Application_Model_FilterMapper(); + $newfilter2->save($newfilter); + $this->_redirect('/user/filter/index/addresult/ok'); + }catch (Zend_Exception $e) { + echo "Error message 2: " . $e->getMessage() . "\n"; + $this->_redirect('/user/filter/index/addresult/error'); + } + } + $this->view->addfilterform = $addfilterform; + } + } + + public function removefilterAction() + { + // action body + } + + public function editfilterAction() + { + // action body + } + + public function addfilterentryAction() + { + // action body + } + + public function editfilterentryAction() + { + // action body + } + + public function removefilterentryAction() { // action body } @@ -16,3 +103,15 @@ class User_FilterController extends Zend_Controller_Action } + + + + + + + + + + + + diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index 7ff4da1..f786aa8 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -5,6 +5,11 @@ class User_PoolController extends Zend_Controller_Action private $membership; public function init() { + if($_SESSION['membershipID'] ==''){ + $pbsNotifier = new Pbs_Notifier(); + echo $pbsNotifier->notify('No membershipID set','forbidden'); + } + $membershipMapper = new Application_Model_MembershipMapper(); $this->membership = new Application_Model_Membership(); $membershipMapper->find($_SESSION['membershipID'],$this->membership); @@ -41,7 +46,14 @@ class User_PoolController extends Zend_Controller_Action } $poolMapper = new Application_Model_PoolMapper(); - $this->view->pools = $poolMapper->fetchAll(); + $pools = $poolMapper->findBy('groupID',$this->membership->getGroupID()); + foreach($pools as $pool){ + $ff = new Application_Model_Pool(); + $ff->setOptions($pool); + $ff->setID($pool['poolID']); + $yourpools[] = $ff; + } + $this->view->pools = $yourpools; $clientmapper = new Application_Model_ClientMapper(); $clients = $clientmapper->fetchAll(); diff --git a/application/modules/user/forms/Filter.php b/application/modules/user/forms/Filter.php new file mode 100644 index 0000000..69aaf4b --- /dev/null +++ b/application/modules/user/forms/Filter.php @@ -0,0 +1,68 @@ +<?php + +class user_Form_Filter extends Zend_Form +{ + + private $bootmenus; + + public function init() + { + $this->setName("Add Filter"); + $this->setMethod('post'); + + $this->addElement('text', 'title', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Title:', + )); + $this->addElement('textarea', 'description', array( + 'filters' => array('StringTrim'), + 'required' => false, + 'label' => 'Description:', + )); + + $bootmenufield = $this->createElement('select','bootmenuID'); + $bootmenufield ->setLabel('Bootmenu:'); + + if(count($this->bootmenus)>0){ + foreach($this->bootmenus as $id => $g){ + $bootmenufield->addMultiOption($g->getID(), $g->getTitle()); + } + } + $bootmenufield->setRegisterInArrayValidator(false); + $this->addElement($bootmenufield); + + $this->addElement('text', 'priority', array( + 'filters' => array('StringTrim'), + 'validators' => array( + array('StringLength', false, array(0, 50)), + ), + 'required' => true, + 'label' => 'Priority:', + )); + $this->addElement('submit', 'add', array( + 'required' => false, + 'ignore' => true, + 'label' => $this->buttontext, + )); + + $this->addElement('button', 'Cancel', array( + 'onclick' => 'self.location="/user/filter"' + )); + } + function setBootmenus($val){ + $this->bootmenus = $val; + return; + } + private $buttontext = 'Save'; + function setButtontext($v){ + $this->buttontext = $v; + } + + + +} + diff --git a/application/modules/user/views/scripts/filter/addfilter.phtml b/application/modules/user/views/scripts/filter/addfilter.phtml new file mode 100644 index 0000000..3c7eb9f --- /dev/null +++ b/application/modules/user/views/scripts/filter/addfilter.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->addfilterform; diff --git a/application/modules/user/views/scripts/filter/addfilterentry.phtml b/application/modules/user/views/scripts/filter/addfilterentry.phtml new file mode 100644 index 0000000..f7240c8 --- /dev/null +++ b/application/modules/user/views/scripts/filter/addfilterentry.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>addfilterentry</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/editfilter.phtml b/application/modules/user/views/scripts/filter/editfilter.phtml new file mode 100644 index 0000000..452a096 --- /dev/null +++ b/application/modules/user/views/scripts/filter/editfilter.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>editfilter</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/editfilterentry.phtml b/application/modules/user/views/scripts/filter/editfilterentry.phtml new file mode 100644 index 0000000..60a1f6f --- /dev/null +++ b/application/modules/user/views/scripts/filter/editfilterentry.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>editfilterentry</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/index.phtml b/application/modules/user/views/scripts/filter/index.phtml index bace90f..94d77d7 100644 --- a/application/modules/user/views/scripts/filter/index.phtml +++ b/application/modules/user/views/scripts/filter/index.phtml @@ -1 +1,123 @@ -<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>index</b></center>
\ No newline at end of file +<h1>Filters</h1> +<?php if($this->notification != ''){echo $this->notification;} ?> +<?php echo $this->formButton('createconfig', 'Create Filter', array( + 'onclick' => 'self.location="/user/filter/addfilter"', + 'class' => 'addbutton'))?> + +<?php if ($this->filters): ?> + <table> + <tr> + <th>ID</th> + <th>Title</th> + <th>Description</th> + <th>Priority</th> + <th>TargetBootMenu</th> + <th colspan=3>Actions</th> + </tr> + <?php foreach ($this->filters as $filter): ?> + <tr class='entry'> + <td><?php echo $this->escape($filter->getID()) ?></td> + <td><?php echo $this->escape($filter->title) ?></td> + <td><?php echo $this->escape($filter->Description) ?></td> + <td><?php echo $this->escape($filter->priority) ?></td> + <td><?php echo $this->escape($filter->bootmenuID) ?></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'editfilter', + 'filterID' => $filter->getID() + ), + 'default', + true) ?>"><img src='/media/img/edit.png' alt='Edit Filter'/></a></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'removefilter', + 'filterID' => $filter->getID() + ), + 'default', + true) ?>"><img src='/media/img/delete.png' alt='Delete Filter'/></a></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'addfilterentry', + 'filterID' => $filter->getID() + ), + 'default', + true) ?>"><img src='/media/img/add.png' alt='Add Filterentry'/></a></td> + </tr> + <?php + $fe = new Application_Model_FilterEntriesMapper(); + # print_a($erg = $fe->findBy('filterID',$filter->getID())); + $erg = $fe->findBy('filterID',$filter->getID()); + ?> + <?php if (count($erg)>0): ?> + <tr class=detail> + <td class=arrowtop>↳</td> + <td colspan=7> + <?php + + ?> + <table> + <tr> + <th>Filtertype</th> + <th>Value</th> + <th>Value2</th> + <th colspan=2>Actions</th> + </tr> + <?php foreach ($erg as $filterentry): ?> + + <tr> + <td><?php + + $filter2 = new Application_Model_FilterTypeMapper(); + $erg = new Application_Model_FilterType(); + $filter2->find($filterentry['filtertypeID'],$erg); + //name zur ID finden + echo "[".$filterentry['filtertypeID']."] "; + echo $erg->getFiltertypename(); + + + ?></td> + <td><?php echo $filterentry['filtervalue'];?></td> + <td><?php echo $filterentry['filtervalue2'];?></td> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'editfilterentry', + 'filterentriesID' => $filterentry['filterentriesID'] + ), + 'default', + true) ?>"><img src='/media/img/edit.png' alt='Edit Filterentry'/></a> + <td class='action'><a href="<?php echo $this->url( + array( + 'module' => 'user', + 'controller' => 'filter', + 'action' => 'removefilterentry', + 'filterentriesID' => $filterentry['filterentriesID'] + ), + 'default', + true) ?>"><img src='/media/img/delete.png' alt='Delete Filterentry'/></a> + </tr> + + <?php endforeach ?> + </table> + </td> + </tr> + <?php endif;?> + <?php endforeach ?> + </table> + + +<?php else: ?> + + <p>There are no filters to display.</p> + +<?php endif;?> +<?php echo $this->formButton('createconfig', 'Test Filters', array( + 'onclick' => 'self.location="/user/filter/testevaluate"', + 'class' => 'addbutton'))?> diff --git a/application/modules/user/views/scripts/filter/removefilter.phtml b/application/modules/user/views/scripts/filter/removefilter.phtml new file mode 100644 index 0000000..a46f9ec --- /dev/null +++ b/application/modules/user/views/scripts/filter/removefilter.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>removefilter</b></center>
\ No newline at end of file diff --git a/application/modules/user/views/scripts/filter/removefilterentry.phtml b/application/modules/user/views/scripts/filter/removefilterentry.phtml new file mode 100644 index 0000000..dc7189d --- /dev/null +++ b/application/modules/user/views/scripts/filter/removefilterentry.phtml @@ -0,0 +1 @@ +<br /><br /><center>View script for controller <b>Filter</b> and script/action name <b>removefilterentry</b></center>
\ No newline at end of file diff --git a/library/Pbs/Notifier.php b/library/Pbs/Notifier.php index 23fec57..1c7dfca 100644 --- a/library/Pbs/Notifier.php +++ b/library/Pbs/Notifier.php @@ -6,6 +6,20 @@ class Pbs_Notifier{ public function notify($action,$result){ switch($action){ + default: + switch($result){ + case "forbidden": + $result = "errorbox"; + break; + case "ok": + $result = "okbox"; + break; + case "error": + $result = "warningbox"; + break; + } + $result = "<div class='$result'>$action</div>"; + break; case "delete": switch($result){ case "forbidden": diff --git a/library/Pbs/Session.php b/library/Pbs/Session.php index 592b89c..eb7c927 100644 --- a/library/Pbs/Session.php +++ b/library/Pbs/Session.php @@ -2,7 +2,7 @@ class Pbs_Session{ - public function createsession(Application_Model_Session $session){ + public function CreateSession(Application_Model_Session $session){ $sessionmapper = new Application_Model_SessionMapper(); $uniqid = $this->getUniqueCode(10); @@ -16,6 +16,18 @@ class Pbs_Session{ $sessionmapper->find($id, $session); return $session; } + public function createClient(Application_Model_Client $client){ + $clientmapper = new Application_Model_ClientMapper(); + $result = $clientmapper->findBy('macadress',$client->getMacadress()); + if(($result)>0){ + $client->setOptions($result); + } + else{ + $id = $clientmapper->save($client); + $clientmapper->find($id, $client); + } + return $client; + } private function getUniqueCode($length = "") { $code = md5(uniqid(rand(), true)); diff --git a/pbs-newdata.sql b/pbs-newdata.sql index a412195..1490fd5 100644 --- a/pbs-newdata.sql +++ b/pbs-newdata.sql @@ -55,9 +55,9 @@ INSERT INTO `pbs_bootos` (`bootosID`, `configID`, `groupID`, `membershipID`, `ti -- Adding bootiso INSERT INTO `pbs_bootiso` (`bootisoID`, `title`, `membershipID`, `groupID`, `path`, `serialnumber`, `created`, `expires`, `public`) VALUES -(1, 'BootIso 1', 1, 1, 'Path 1', 123456789, '1299693879', '2012-03-09', 0), -(2, 'BootIso 2', 1, 1, 'Path 2', 2147483647, '1299693899', '2012-03-09', 0), -(3, 'BootIso 3', 1, 1, 'Path 3', 2147483647, '1299693899', '2012-03-09', 0); +(1, 'BootIso 1', 1, 1, 'Path 1', 123456789, '123', '2012-03-09', 0), +(2, 'BootIso 2', 1, 1, 'Path 2', 2147483647, '456', '2012-03-09', 0), +(3, 'BootIso 3', 1, 1, 'Path 3', 2147483647, '789', '2012-03-09', 0); -- Adding Pools INSERT INTO `pbs_pool` (`poolID`, `groupID`, `title`, `description`, `location`) VALUES @@ -209,6 +209,7 @@ CREATE TABLE IF NOT EXISTS `pbs_client` ( PRIMARY KEY (`clientID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1; ALTER TABLE `pbs_client` ADD `groupID` INT NOT NULL AFTER `clientID` ; +ALTER TABLE `pbs_client` ADD UNIQUE (`macadress`); ALTER TABLE `pbs_client` ADD CONSTRAINT `pbs_client_ibfk_1` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE; |