From 5f6c99a519cb14e5d67dab562c786a8bc10109f2 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Apr 2011 13:17:31 +0200 Subject: Suche mit "text 1" möglich --- library/Pbs/Search.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 46f4021..138ebcf 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -9,7 +9,7 @@ class Pbs_Search{ public function searchForm(){ $str = "
- searchTerm != '')?'value="'.$this->searchTerm.'"':'')."> + searchTerm != '')?'value="'.htmlentities($this->searchTerm, ENT_QUOTES).'"':'')."> "; $highlight = array(); if($this->searchTerm != ''){ @@ -43,14 +43,27 @@ class Pbs_Search{ public function setSearchTerm($search){ $this->searchTerm = trim($search); - $parts = explode(" ",$this->searchTerm); + // search for "text" + preg_match_all("!\"(.*?)\"!is",$this->searchTerm,$matches); + $tmpsearch = $this->searchTerm; + for($i=0;$i<=count($matches[0]);$i++){ + $replace = str_replace(" ","<|>",$matches[0][$i]); + $tmpsearch = str_replace($matches[0][$i],$replace,$tmpsearch); + } + $parts = explode(" ",$tmpsearch); foreach($parts as $search){ if(stristr($search,":") && preg_match('/^[a-z_A-Z]+$/',$search) >= 0){ $key = substr($search,0,strpos($search,":")); - $value = substr($search,strpos($search,":")+1); + $value = substr($search,strpos($search,":")+1); + if(stristr($value,'"')){ + $value = substr(str_replace('<|>',' ',$value),1,-1); + } $searcha[$key] = $value; } else{ + if(stristr($search,'"')){ + $search = substr(str_replace('<|>',' ',$search),1,-1); + } $searchb[] = $search; } } -- cgit v1.2.3-55-g7522 From 5691410e622b6245dbbf9d90a98ebfd7ace783b5 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Apr 2011 14:07:04 +0200 Subject: fehler in suche gefixxt --- library/Pbs/Search.php | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 138ebcf..971bdab 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -69,7 +69,6 @@ class Pbs_Search{ } $this->searcha = $searcha; $this->searchb = $searchb; - #print_a($searcha,$searchb); } public function getSearchTerm(){ return $this->searchTerm; @@ -91,33 +90,25 @@ class Pbs_Search{ foreach($this->searcha as $sk => $sv){ if($k == $sk){ if(stristr($v,$sv)){ - $com1[] = $counter; + $com1[$counter] += 1; } } } } - if(count($searchb) >= 0){ - foreach($this->searchb as $sk => $sv){ + if(count($this->searchb) >= 0){ + foreach($this->searchb as $sk => $sv){ $comm = stristr($v,$sv); if($comm != false){ - $com2[] = $counter; - break; + $com2[$counter] += 1; } } } } - - } - if (count($this->searcha) == 0){ - $data = $com2; - } - if (count($this->searchb) == 0){ - $data = $com1; - } - if (count($this->searcha) > 0 && count($this->searchb) > 0){ - $data = array_intersect($com1,$com2); + if($com2[$counter] >= count($this->searchb) && $com1[$counter] >= count($this->searcha)){ + // add item in resultlist + $data[] = $counter; + } } - $data = array_unique($data); foreach( $data as $c) $ges[] = $array[$c]; return $ges; -- cgit v1.2.3-55-g7522 From bd5988e7b8c3377a3768efc1dedabd199a90c342 Mon Sep 17 00:00:00 2001 From: michael pereira Date: Tue, 5 Apr 2011 15:34:21 +0200 Subject: find Methode angepasst --- application/models/BootMenuEntriesMapper.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php index 4d82c96..02c5e07 100644 --- a/application/models/BootMenuEntriesMapper.php +++ b/application/models/BootMenuEntriesMapper.php @@ -119,7 +119,7 @@ class Application_Model_BootMenuEntriesMapper } } - public function find($id, Application_Model_BootMenuEntries $botmenuentries) + public function find($id, Application_Model_BootMenuEntries $botmenuentries = null) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { @@ -128,8 +128,13 @@ class Application_Model_BootMenuEntriesMapper $row = $result->current(); - $botmenuentries->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order); - + if($botmenuentries == null){ + $botmenuentries = new Application_Model_BootMenuEntriesMapper(); + $botmenuentries->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order); + return $botmenuentries; + }else{ + $botmenuentries->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order); + } } public function fetchAll() -- cgit v1.2.3-55-g7522 From 198221618856ef22ab8f69874b8d4e101db3746d Mon Sep 17 00:00:00 2001 From: michael pereira Date: Tue, 5 Apr 2011 15:35:32 +0200 Subject: Rechte in Controller eingepflanzt --- .../modules/user/controllers/BootisoController.php | 35 +++++++--------- .../user/controllers/BootmenuController.php | 18 ++++---- .../modules/user/controllers/BootosController.php | 39 ++++++++---------- .../modules/user/controllers/ConfigController.php | 48 ++++++++++++---------- .../modules/user/controllers/PrebootController.php | 41 ++++++++---------- pbs.sql | 4 +- 6 files changed, 86 insertions(+), 99 deletions(-) diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index a6fbe9e..84d51ab 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -58,8 +58,8 @@ class user_BootisoController extends Zend_Controller_Action $groupID = $this->membership->getGroupID(); - //TODO ACL Darf er BootISOMenu sehen? - if(false) + //ACL Darf er BootISOMenu sehen? + if(!Pbs_Acl::checkRight('bai') && !Pbs_Acl::checkRight('bui')) $this->_redirect('/user/index'); $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); @@ -91,9 +91,8 @@ class user_BootisoController extends Zend_Controller_Action $this->view->pagination = $pagination->pagination($pageurl); $this->view->page = $pagination->getRequestPage(); $this->view->bootisolist= $this->view->bootisolist; - - - + + $prebootMapper = new Application_Model_PreBootMapper(); $this->view->prebootlist = array(); @@ -112,8 +111,8 @@ class user_BootisoController extends Zend_Controller_Action - //TODO ACL Darf er BootISOs downloaden? - if(false) + //ACL Darf er BootISOs downloaden? + if(!Pbs_Acl::checkRight('bdld')) $this->_redirect('/user/bootiso/index/page/'.$this->page.'/downloadresult/forbidden'); $prebootID = $this->_request->getParam('prebootID'); @@ -145,8 +144,8 @@ class user_BootisoController extends Zend_Controller_Action public function createbootisoAction() { - //TODO ACL Darf er BootISOs erstellen? - if(false) + //ACL Darf er BootISOs erstellen? + if(!Pbs_Acl::checkRight('bc')) $this->_redirect('/user/bootiso/index/page/'.$this->page.'/addresult/forbidden'); $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); @@ -162,7 +161,6 @@ class user_BootisoController extends Zend_Controller_Action 'action' => 'createbootiso', 'prebootlist' => $prebootlist, 'groupdepth' => $childgroups, - 'rights' => null, 'page'=>$this->page)); } else { @@ -170,14 +168,12 @@ class user_BootisoController extends Zend_Controller_Action 'action' => 'createbootiso', 'prebootlist' => $prebootlist, 'groupdepth' => $childgroups, - 'rights' => null, 'page'=>$this->page),$_POST); if ($bootisoForm->isValid($_POST)) { $bootiso = new Application_Model_BootIso($_POST); - $bootiso->setMembershipID($this->membership->getID()); $bootiso->setGroupID($this->membership->getGroupID()); $bootiso->setCreated(time()); @@ -213,8 +209,8 @@ class user_BootisoController extends Zend_Controller_Action public function editbootisoAction() { - //TODO ACL Darf er BootISOs editieren? - if(false) + //ACL Darf er BootISOs editieren? + if(!Pbs_Acl::checkRight('be')) $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); $bootisoID = $this->_request->getParam('bootisoID'); @@ -241,7 +237,6 @@ class user_BootisoController extends Zend_Controller_Action 'action' => 'editbootiso', 'prebootlist' => $prebootlist, 'groupdepth' => $childgroups, - 'rights' => 'meta', 'page' => $this->page)); $bootisoForm->populate($bootiso->toArray()); @@ -250,7 +245,6 @@ class user_BootisoController extends Zend_Controller_Action 'action' => 'editbootiso', 'prebootlist' => $prebootlist, 'groupdepth' => $childgroups, - 'rights' => 'meta', 'page' => $this->page),$_POST); if ($bootisoForm->isValid($_POST)) { @@ -258,7 +252,6 @@ class user_BootisoController extends Zend_Controller_Action $bootisoold = $bootiso; $bootiso = new Application_Model_BootIso($_POST); - $bootiso->setMembershipID($this->membership->getID()); $bootiso->setGroupID($this->membership->getGroupID()); $bootiso->setCreated(time()); $bootiso->setID($bootisoID); @@ -268,8 +261,8 @@ class user_BootisoController extends Zend_Controller_Action $bootiso->getExpires() != $bootisoold->getExpires() || $bootiso->getPublic() != $bootisoold->getPublic() || $bootiso->getSerialnumber() != $bootisoold->getSerialnumber()){ - //TODO ACL Is he allowed to edit other than Metadata? - if(false) + //ACL Is he allowed to edit other than Metadata? + if(Pbs_Acl::checkRight('bem')) $this->_redirect('/user/bootiso/index/page/'.$this->page.'/modifyresult/forbidden'); } @@ -303,8 +296,8 @@ class user_BootisoController extends Zend_Controller_Action public function deletebootisoAction() { - //TODO ACL Darf er BootISOs löschen? - if(false) + //ACL Darf er BootISOs löschen? + if(!Pbs_Acl::checkRight('bd')) $this->_redirect('/user/bootiso/index/page/'.$this->page.'/deleteresult/forbidden'); try{ diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index 7843b3f..b18adbe 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -57,8 +57,8 @@ class user_BootmenuController extends Zend_Controller_Action } - //TODO ACL Darf er Bootmenus sehen? - if(false) + //ACL Darf er Bootmenus sehen? + if(!Pbs_Acl::checkRight('booai') && !Pbs_Acl::checkRight('booui')) $this->_redirect('/user/index'); $this->bootMenumapper = new Application_Model_BootMenuMapper(); @@ -66,8 +66,7 @@ class user_BootmenuController extends Zend_Controller_Action $bootosMapper = new Application_Model_BootOsMapper(); $configMapper = new Application_Model_ConfigMapper(); - if(true){ - //TODO nur Bootmenus von Admins + if(Pbs_Acl::checkRight('booai')){ $bootmenu = $this->bootmenuMapper->findBy(array('groupID' => $this->membership->getGroupID())); foreach ($bootmenu as $bm){ $bootmenuID = $bm->getID(); @@ -107,22 +106,23 @@ class user_BootmenuController extends Zend_Controller_Action public function createbootmenuAction() { - //TODO ACL Darf er BootMenus erstellen? - if(false) + //ACL Darf er BootMenus erstellen? + if(!Pbs_Acl::checkRight('booc')) $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/addresult/forbidden'); if (!isset($_POST["createbootmenu"])){ - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'rights' => 'all','page' => $this->page)); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page)); } else { - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu', 'rights' => 'all','page' => $this->page),$_POST); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'createbootmenu','page' => $this->page),$_POST); if ($bootmenuForm->isValid($_POST)) { $bootmenu = new Application_Model_BootMenu($_POST); + $bootmenu->setCreated(time()); + $bootmenu->setMembershipID($this->membership->getID()); $bootmenu->setGroupID($this->membership->getGroupID()); - $bootmenu->setCreated(time()); try{ $this->bootmenuMapper->save($bootmenu); diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php index 8f602fe..34fddd0 100644 --- a/application/modules/user/controllers/BootosController.php +++ b/application/modules/user/controllers/BootosController.php @@ -57,8 +57,8 @@ class user_BootosController extends Zend_Controller_Action $groupID = $this->membership->getGroupID(); - //TODO ACL Darf er BootOsMenu sehen? - if(false) + //ACL Darf er BootOs sehen? + if(!Pbs_Acl::checkRight('boai') && !Pbs_Acl::checkRight('boui')) $this->_redirect('/user/index'); $configMapper = new Application_Model_ConfigMapper(); @@ -96,8 +96,8 @@ class user_BootosController extends Zend_Controller_Action public function createbootosAction() { - //TODO ACL Darf er BootISOs erstellen? - if(false) + //ACL Darf er BootISOs erstellen? + if(!Pbs_Acl::checkRight('boc')) $this->_redirect('/user/bootos/index/page/'.$this->page.'/addresult/forbidden'); $groupID = $this->membership->getGroupID(); @@ -105,7 +105,6 @@ class user_BootosController extends Zend_Controller_Action $groupgroupsMapper = new Application_Model_GroupGroupsMapper(); $childgroups = count($groupgroupsMapper->getChildGroups($groupID)); - //TODO nur configs von admins $configMapper = new Application_Model_ConfigMapper(); $configlist = $configMapper->findBy(array("groupID" => $groupID)); @@ -114,7 +113,6 @@ class user_BootosController extends Zend_Controller_Action 'action' => 'createbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, - 'rights' => 'all', 'page' => $this->page)); } else { @@ -122,14 +120,12 @@ class user_BootosController extends Zend_Controller_Action 'action' => 'createbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, - 'rights' => 'all', 'page' => $this->page),$_POST); if ($bootosForm->isValid($_POST)) { $bootos = new Application_Model_BootOs($_POST); - $bootos->setMembershipID($this->membership->getID()); $bootos->setGroupID($this->membership->getGroupID()); $bootos->setCreated(time()); @@ -180,8 +176,8 @@ class user_BootosController extends Zend_Controller_Action public function checkupdateAction($bootos) { - //TODO ACL Is he allowed to update Preboots? - if(false) + //ACL Is he allowed to update Preboots? + if(!Pbs_Acl::checkRight('bou')) $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden'); $bootosID = $bootos->getID(); @@ -217,8 +213,8 @@ class user_BootosController extends Zend_Controller_Action public function updatebootosAction() { - //TODO ACL Is he allowed to update Preboots? - if(false) + //ACL Is he allowed to update Preboots? + if(!Pbs_Acl::checkRight('bou')) $this->_redirect('/user/bootiso/index/page/'.$this->page.'/updateresult/forbidden'); $bootosID = $this->_request->getParam('bootosID'); @@ -252,8 +248,8 @@ class user_BootosController extends Zend_Controller_Action public function editbootosAction() { - //TODO ACL Is he allowed to edit Preboots? - if(false) + //ACL Is he allowed to edit Preboots? + if(!Pbs_Acl::checkRight('boe')) $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); $bootosID = $this->_request->getParam('bootosID'); @@ -280,7 +276,6 @@ class user_BootosController extends Zend_Controller_Action 'action' => 'editbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, - 'rights' => 'meta', 'page' => $this->page)); $bootosForm->populate($bootos->toArray()); @@ -290,7 +285,6 @@ class user_BootosController extends Zend_Controller_Action 'action' => 'editbootos', 'groupdepth' => $childgroups, 'configlist'=>$configlist, - 'rights' => 'meta', 'page' => $this->page),$_POST); if ($bootosForm->isValid($_POST)) { @@ -298,7 +292,6 @@ class user_BootosController extends Zend_Controller_Action $bootosold = $bootos; $bootos = new Application_Model_BootOs($_POST); - $bootos->setMembershipID($this->membership->getID()); $bootos->setGroupID($this->membership->getGroupID()); $bootos->setCreated(time()); if($bootos->getConfigID() == '') @@ -309,14 +302,14 @@ class user_BootosController extends Zend_Controller_Action $bootos->getDefaultkcl() != $bootosold->getDefaultkcl() || $bootos->getExpires() != $bootosold->getExpires() || $bootos->getPublic() != $bootosold->getPublic() ){ - //TODO ACL Is he allowed to edit this? - if(false) + //ACL Is he allowed to edit this? + if(Pbs_Acl::checkRight('boem')) $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); } if($bootos->getPath_kernel() != $bootosold->getPath_kernel() || $bootos->getPath_init() != $bootosold->getPath_init()){ - //TODO ACL Is he allowed to edit the Kernel/Init Path? - if(false) + //ACL Is he allowed to edit the Kernel/Init Path? + if(Pbs_Acl::checkRight('boem')) $this->_redirect('/user/bootos/index/page/'.$this->page.'/modifyresult/forbidden'); $path_tmp = "../resources/bootos/"; @@ -366,8 +359,8 @@ class user_BootosController extends Zend_Controller_Action public function deletebootosAction() { - //TODO ACL Is he allowed to delete Bootos? - if(false) + //ACL Is he allowed to delete Bootos? + if(!Pbs_Acl::checkRight('bod')) $this->_redirect('/user/bootos/index/page/'.$this->page.'/deleteresult/forbidden'); try{ diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php index 83ff804..000a5e9 100644 --- a/application/modules/user/controllers/ConfigController.php +++ b/application/modules/user/controllers/ConfigController.php @@ -48,15 +48,14 @@ class user_ConfigController extends Zend_Controller_Action $groupID = $this->membership->getGroupID(); - //TODO ACL Darf er Configs sehen? - if(false) + //ACL Darf er Configs sehen? + if(!Pbs_Acl::checkRight('csai') && !Pbs_Acl::checkRight('csui')) $this->_redirect('/user/index'); $this->configMapper = new Application_Model_ConfigMapper(); $groupMapper = new Application_Model_GroupMapper(); - if(true){ - //TODO nur Configs von Admins + if(Pbs_Acl::checkRight('csai')){ $this->view->configlist = $this->configMapper->findBy(array('groupID' => $this->membership->getGroupID())); }else{ $this->view->configlist = $this->configMapper->findBy(array('membershipID' => $this->membership->getID())); @@ -82,22 +81,25 @@ class user_ConfigController extends Zend_Controller_Action public function createconfigAction() { - //TODO ACL Darf er Configs erstellen? - if(false) + //ACL Darf er Configs erstellen? + if(!Pbs_Acl::checkRight('cc')) $this->_redirect('/user/config/index/page/'.$this->page.'/addresult/forbidden'); if (!isset($_POST["createconfig"])){ - $configForm = new user_Form_Config(array('action' => 'createconfig','rights' => null,'page'=>$this->page)); + $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page)); } else { - $configForm = new user_Form_Config(array('action' => 'createconfig','rights' => null,'page'=>$this->page),$_POST); + $configForm = new user_Form_Config(array('action' => 'createconfig','page'=>$this->page),$_POST); if ($configForm->isValid($_POST)) { $config = new Application_Model_Config($_POST); $config->setCreated(time()); - $config->setMembershipID($this->membership->getID()); - $config->setGroupID($this->membership->getGroupID()); - + + if(Pbs_Acl::checkRight('csai')) + $config->setGroupID($this->membership->getGroupID()); + else + $config->setMembershipID($this->membership->getID()); + try { $this->configMapper->save($config); }catch(Zend_Exception $e) @@ -115,8 +117,8 @@ class user_ConfigController extends Zend_Controller_Action public function editconfigAction() { - //TODO ACL Darf er Configs editieren? - if(false) + //ACL Darf er Configs editieren? + if(!Pbs_Acl::checkRight('ce')) $this->_redirect('/user/config/index/page/'.$this->page.'/modifyresult/forbidden'); $configID = $this->_request->getParam('configID'); @@ -138,11 +140,11 @@ class user_ConfigController extends Zend_Controller_Action if (!isset($_POST["editconfig"])){ - $configForm = new user_Form_Config(array('action' => 'editconfig','rights' => 'meta','page'=>$this->page)); + $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page)); $configForm->populate($config->toArray()); }else{ - $configForm = new user_Form_Config(array('action' => 'editconfig','rights' => 'meta','page'=>$this->page),$_POST); + $configForm = new user_Form_Config(array('action' => 'editconfig','page'=>$this->page),$_POST); if ($configForm->isValid($_POST)) { @@ -150,13 +152,17 @@ class user_ConfigController extends Zend_Controller_Action $config = new Application_Model_Config($_POST); $config->setCreated(time()); - $config->setMembershipID($this->membership->getID()); - $config->setGroupID($this->membership->getGroupID()); + + if(Pbs_Acl::checkRight('csai')) + $config->setGroupID($this->membership->getGroupID()); + else + $config->setMembershipID($this->membership->getID()); + $config->setID($configID); if($configold->getShellscript() != $config->getShellscript()){ - //TODO ACL Is he allowed to edit other than Metadata? - if(false) + //ACL Is he allowed to edit other than Metadata? + if(Pbs_Acl::checkRight('cem')) $this->_redirect('/user/config/index/page/'.$this->page.'/modifyresult/forbidden'); } @@ -180,8 +186,8 @@ class user_ConfigController extends Zend_Controller_Action public function deleteconfigAction() { - //TODO ACL Darf er Configs löschen? - if(false) + //ACL Darf er Configs löschen? + if(!Pbs_Acl::checkRight('cd')) $this->_redirect('/user/config/index/page/'.$this->page.'/deleteresult/forbidden'); try{ diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index 6944e27..0572c32 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -58,8 +58,8 @@ class User_PrebootController extends Zend_Controller_Action $groupID = $this->membership->getGroupID(); - //TODO ACL Darf er PrebootMenu sehen? - if(false) + //ACL Darf er PrebootMenu sehen? + if(!Pbs_Acl::checkRight('pro')) $this->_redirect('/user/index'); $this->view->prebootlist = $this->prebootMapper->findBy(array("groupID" => $groupID)); @@ -76,8 +76,7 @@ class User_PrebootController extends Zend_Controller_Action $this->view->page = $pagination->getRequestPage(); $this->view->prebootlist= $this->view->prebootlist; - - + $this->view->update = array(); $update = $this->_request->getParam('checkupdate'); @@ -92,8 +91,8 @@ class User_PrebootController extends Zend_Controller_Action public function createprebootAction() { - //TODO ACL Is he allowed to create Preboots? - if(false) + //ACL Is he allowed to create Preboots? + if(!Pbs_Acl::checkRight('prc')) $this->_redirect('/user/preboot/index/page/'.$this->page.'/addresult/forbidden'); if (!isset($_POST["createpreboot"])){ @@ -109,8 +108,7 @@ class User_PrebootController extends Zend_Controller_Action if ($prebootForm->isValid($_POST)) { $preboot = new Application_Model_PreBoot($_POST); - $preboot->setMembershipID($this->membership->getID()); - $preboot->setGroupID($this->membership->getGroupID()); + $preboot->setGroupID($this->membership->getGroupID()); try { @@ -153,8 +151,8 @@ class User_PrebootController extends Zend_Controller_Action public function checkupdateAction($preboot) { - //TODO ACL Is he allowed to update Preboots? - if(false) + //ACL Is he allowed to update Preboots? + if(!Pbs_Acl::checkRight('pru')) $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden'); $prebootID = $preboot->getID(); @@ -184,8 +182,8 @@ class User_PrebootController extends Zend_Controller_Action public function updateprebootAction() { - //TODO ACL Is he allowed to update Preboots? - if(false) + //ACL Is he allowed to update Preboots? + if(!Pbs_Acl::checkRight('pru')) $this->_redirect('/user/preboot/index/page/'.$this->page.'/updateresult/forbidden'); $prebootID = $this->_request->getParam('prebootID'); @@ -243,8 +241,8 @@ class User_PrebootController extends Zend_Controller_Action public function editprebootAction() { - //TODO ACL Is he allowed to edit Preboots? - if(false) + //ACL Is he allowed to edit Preboots? + if(!Pbs_Acl::checkRight('pre')) $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden'); $prebootID = $this->_request->getParam('prebootID'); @@ -262,16 +260,14 @@ class User_PrebootController extends Zend_Controller_Action if (!isset($_POST["editpreboot"])){ $prebootForm = new user_Form_Preboot(array( - 'action' => 'editpreboot', - 'rights' => 'meta', + 'action' => 'editpreboot', 'page' => $this->page)); $prebootForm->populate($preboot->toArray()); }else{ $prebootForm = new user_Form_Preboot(array( - 'action' => 'editpreboot', - 'rights' => 'meta', + 'action' => 'editpreboot', 'page' => $this->page),$_POST); if ($prebootForm->isValid($_POST)) { @@ -279,7 +275,6 @@ class User_PrebootController extends Zend_Controller_Action $prebootold = $preboot; $preboot = new Application_Model_PreBoot($_POST); - $preboot->setMembershipID($this->membership->getID()); $preboot->setGroupID($this->membership->getGroupID()); $preboot->setID($prebootID); @@ -287,8 +282,8 @@ class User_PrebootController extends Zend_Controller_Action if($preboot->getPath_preboot() != $prebootold->getPath_preboot()){ - //TODO ACL Is he allowed to edit the Preboot Path? - if(false) + //ACL Is he allowed to edit the Preboot Path? + if(Pbs_Acl::checkRight('prem')) $this->_redirect('/user/preboot/index/page/'.$this->page.'/modifyresult/forbidden'); exec("wget -O '".$path_preboot."preboot.zip' ".escapeshellcmd($preboot->getPath_preboot()) ." 2>&1 | grep 'saved'" , $status); @@ -350,8 +345,8 @@ class User_PrebootController extends Zend_Controller_Action public function deleteprebootAction() { - //TODO ACL Is he allowed to delete Preboots? - if(false) + //ACL Is he allowed to delete Preboots? + if(!Pbs_Acl::checkRight('prd')) $this->_redirect('/user/preboot/index/page/'.$this->page.'/deleteresult/forbidden'); try{ diff --git a/pbs.sql b/pbs.sql index bd4985d..f8a7ee5 100644 --- a/pbs.sql +++ b/pbs.sql @@ -117,7 +117,7 @@ ALTER TABLE `pbs_membership` CREATE TABLE IF NOT EXISTS `pbs_config` ( `configID` int(11) NOT NULL AUTO_INCREMENT, `title` varchar(30) NOT NULL, - `groupID` int(11) NOT NULL, + `groupID` int(11), `membershipID` int(11), `shellscript` text NOT NULL, `created` VARCHAR(14) NOT NULL, @@ -158,7 +158,7 @@ ALTER TABLE `pbs_bootos` CREATE TABLE IF NOT EXISTS `pbs_bootmenu` ( `bootmenuID` int(11) NOT NULL AUTO_INCREMENT, `membershipID` int(11), - `groupID` int(11) NOT NULL, + `groupID` int(11), `title` varchar(30) NOT NULL, `created` varchar(14) NOT NULL, PRIMARY KEY (`bootmenuID`), -- cgit v1.2.3-55-g7522 From 92c66441276e03c6fd53496ac8d57ff52b4a3eb4 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Apr 2011 15:54:00 +0200 Subject: Session-Controller erstellt --- .zfproject.xml | 7 ++ application/models/BootMenuEntriesMapper.php | 20 ++++- .../modules/user/controllers/PrebootController.php | 2 +- .../modules/user/controllers/SessionController.php | 89 ++++++++++++++++++++++ application/modules/user/layouts/user.phtml | 1 + .../modules/user/views/scripts/session/index.phtml | 31 ++++++++ library/Pbs/Search.php | 10 ++- 7 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 application/modules/user/controllers/SessionController.php create mode 100644 application/modules/user/views/scripts/session/index.phtml diff --git a/.zfproject.xml b/.zfproject.xml index 21e4994..3a64fde 100644 --- a/.zfproject.xml +++ b/.zfproject.xml @@ -184,6 +184,9 @@ + + + @@ -342,6 +345,9 @@ + + + @@ -827,6 +833,7 @@ + diff --git a/application/models/BootMenuEntriesMapper.php b/application/models/BootMenuEntriesMapper.php index 02c5e07..466b80b 100644 --- a/application/models/BootMenuEntriesMapper.php +++ b/application/models/BootMenuEntriesMapper.php @@ -129,11 +129,25 @@ class Application_Model_BootMenuEntriesMapper $row = $result->current(); if($botmenuentries == null){ - $botmenuentries = new Application_Model_BootMenuEntriesMapper(); - $botmenuentries->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order); + $botmenuentries = new Application_Model_BootMenuEntries(); + $botmenuentries->setID($row->bootmenuentriesID) + ->setBootosID($row->bootosID) + ->setBootmenuID($row->bootmenuID) + ->setTitle($row->title) + ->setConfigID($row->configID) + ->setKcl($row->kcl) + ->setKclappend($row->kclappend) + ->setOrder($row->order); return $botmenuentries; }else{ - $botmenuentries->setID($row->bootmenuentriesID)->setBootosID($row->bootosID)->setBootmenuID($row->bootmenuID)->setTitle($row->title)->setConfigID($row->configID)->setKcl($row->kcl)->setKclappend($row->kclappend)->setOrder($row->order); + $botmenuentries->setID($row->bootmenuentriesID) + ->setBootosID($row->bootosID) + ->setBootmenuID($row->bootmenuID) + ->setTitle($row->title) + ->setConfigID($row->configID) + ->setKcl($row->kcl) + ->setKclappend($row->kclappend) + ->setOrder($row->order); } } diff --git a/application/modules/user/controllers/PrebootController.php b/application/modules/user/controllers/PrebootController.php index 94759f6..f283969 100644 --- a/application/modules/user/controllers/PrebootController.php +++ b/application/modules/user/controllers/PrebootController.php @@ -69,11 +69,11 @@ class User_PrebootController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('preboot'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $this->view->prebootlist = $mySearch->search($this->view->prebootlist); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php new file mode 100644 index 0000000..3c3c192 --- /dev/null +++ b/application/modules/user/controllers/SessionController.php @@ -0,0 +1,89 @@ +hasIdentity()) { + $userIDsNamespace = Zend_Session::namespaceGet('userIDs'); + if($userIDsNamespace['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($userIDsNamespace['membershipID'],$this->membership); + } else { + $this->_helper->redirector('login', 'auth'); + } + $this->page = $this->_request->getParam('page'); + } + + public function indexAction() + { + $sessionMapper = new Application_Model_SessionMapper(); + $bootisoMapper = new Application_Model_BootIsoMapper(); + $bootosMapper = new Application_Model_BootOsMapper(); + $bootmenuentriesMapper = new Application_Model_BootMenuEntriesMapper(); + $membershipMapper = new Application_Model_MembershipMapper(); + $personMapper = new Application_Model_PersonMapper(); + + $bootisos = $bootisoMapper->findBy(array('groupID',$this->membership->getGroupID())); + foreach($bootisos as $bootiso){ + $sessions = $sessionMapper->findBy(array('bootisoID',$bootiso->getID())); + foreach($sessions as $session){ + #echo $session->getBootosID(); + if($session->getBootosID() != '') + $session->setBootosID("[".$session->getBootosID()."] ".$bootosMapper->find($session->getBootosID())->getTitle()); + + if($session->getBootmenuentryID() != '') + $session->setBootmenuentryID("[".$session->getBootmenuentryID()."] ".$bootmenuentriesMapper->find($session->getBootmenuentryID())->getTitle()); + + if($session->getBootisoID() != '') + $session->setBootisoID("[".$session->getBootisoID()."] ".$bootisoMapper->find($session->getBootisoID())->getTitle()); + + if($session->getMembershipID() != ''){ + $personID = $membershipMapper->find($session->getMembershipID())->getPersonID(); + $p = new Application_Model_Person(); + $personMapper->find($personID,$p); + $session->setMembershipID("[".$session->getMembershipID()."] ".$p->getFirstname()." ".$p->getName()); + + } + $mySessions[] =$session; + } + } + + // Search + $search = $this->_request->getParam('search'); + $mySearch = new Pbs_Search(); + $mySearch->setSearchTerm($search); + $mySearch->setModule('session'); + $this->view->searchform = $mySearch->searchForm(); + if($search != ''){ + $this->view->search = $mySearch->getSearchTerm(); + $mySessions = $mySearch->search($mySessions); + } + + // Pagination + $pagination = new Pbs_Pagination(); + $pagination->setPerPage(3); + $pagination->setElement($mySessions); + $pagination->setRequestPage($this->_request->getParam('page')); + $pagination->setPageUrl('/user/session/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); + $mySessions = $pagination->getElements(); + + $this->view->pagination = $pagination->pagination($pageurl); + $this->view->page = $pagination->getRequestPage(); + $this->view->sessions = $mySessions; + + } + + public function searchAction(){ + $this->_redirect('/user/session/index/search/'.($_GET['search'])); + } + + +} + diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml index 84873ef..14ce235 100644 --- a/application/modules/user/layouts/user.phtml +++ b/application/modules/user/layouts/user.phtml @@ -40,6 +40,7 @@ echo $this->headScript()."\n"; + diff --git a/application/modules/user/views/scripts/session/index.phtml b/application/modules/user/views/scripts/session/index.phtml new file mode 100644 index 0000000..bb9f1e2 --- /dev/null +++ b/application/modules/user/views/scripts/session/index.phtml @@ -0,0 +1,31 @@ +

Session

+searchform; ?> + + + + + + + + + + + + + +sessions as $session): ?> + + + + + + + + + + + + + +
ID sessionIDalphasessionID alphasessionIDClientID clientIDBootmenuentryID bootmenyentryIDBootOsID bootosIDBootIsoID bootisoIDMembershipID membershipIDTime timeIP ipIPv6 ip6
escape($session->getID()) ?>escape($session->getAlphasessionID()) ?>escape($session->getClientID()) ?>escape($session->getBootmenuentryID()) ?>escape($session->getBootosID()) ?>escape($session->getBootisoID()) ?>escape($session->getMembershipID()) ?>escape($session->getTime())) ?>escape($session->getIp()) ?>escape($session->getIp6()) ?>
+pagination; ?> diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index 971bdab..eb9d198 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -6,6 +6,8 @@ class Pbs_Search{ private $searcha; private $searchb; private $module; + private $countall; + private $countresult; public function searchForm(){ $str = " @@ -13,8 +15,9 @@ class Pbs_Search{ "; $highlight = array(); if($this->searchTerm != ''){ - $str .= "Delete Client - "; + $str .= "Delete Client"; + $str .= "
$this->countresult results found in $this->countall
"; + $str .=""; foreach($this->getSearchTerms() as $term){ $highlight[] = "$('table').highlight('".$term."');"; } @@ -80,7 +83,7 @@ class Pbs_Search{ return $beta; } public function search($array){ - + $this->countall = count($array); foreach($array as $counter => $cig){ if(is_object($cig)){ $cig = $cig->toArray(); @@ -111,6 +114,7 @@ class Pbs_Search{ } foreach( $data as $c) $ges[] = $array[$c]; + $this->countresult = count($ges); return $ges; } } -- cgit v1.2.3-55-g7522 From 6e476cbdc86f66a154b6794967adaba1a2d0f004 Mon Sep 17 00:00:00 2001 From: michael pereira Date: Tue, 5 Apr 2011 16:21:08 +0200 Subject: Rechte in Alle Controller --- application/models/BootMenuMapper.php | 13 ++++-- .../user/controllers/BootmenuController.php | 49 ++++++++++------------ 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/application/models/BootMenuMapper.php b/application/models/BootMenuMapper.php index 60c506d..1043897 100644 --- a/application/models/BootMenuMapper.php +++ b/application/models/BootMenuMapper.php @@ -93,16 +93,23 @@ class Application_Model_BootMenuMapper } } - public function find($id, Application_Model_BootMenu $botmenu) + public function find($id, Application_Model_BootMenu $botmenu = null) { $result = $this->getDbTable()->find($id); if (0 == count($result)) { return; } - $row = $result->current(); - $botmenu->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created); + if($botmenu == null){ + $botmenu = new Application_Model_BootMenu(); + $botmenu->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created); + return $botmenu; + }else{ + $botmenu->setID($row->bootmenuID)->setMembershipID($row->membershipID)->setGroupID($row->groupID)->setTitle($row->title)->setCreated($row->created); + } + + } public function fetchAll() diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index 84c31ff..78fdde7 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -135,8 +135,7 @@ class user_BootmenuController extends Zend_Controller_Action $bootmenu = new Application_Model_BootMenu($_POST); $bootmenu->setCreated(time()); - - $bootmenu->setMembershipID($this->membership->getID()); + $bootmenu->setGroupID($this->membership->getGroupID()); try{ @@ -156,8 +155,8 @@ class user_BootmenuController extends Zend_Controller_Action public function editbootmenuAction() { - //TODO ACL Is he allowed to edit BootMenus? - if(false) + //ACL Is he allowed to edit BootMenus? + if(!Pbs_Acl::checkRight('booe')) $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/modifyresult/forbidden'); $bootmenuID = $this->_request->getParam('bootmenuID'); @@ -172,26 +171,21 @@ class user_BootmenuController extends Zend_Controller_Action if (!isset($_POST["editbootmenu"])){ - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'rights' => 'all','page' => $this->page)); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page)); $bootmenuForm->populate($bootmenu->toArray()); }else{ - $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu', 'rights' => 'all','page' => $this->page),$_POST); + $bootmenuForm = new user_Form_Bootmenu(array('action' => 'editbootmenu','page' => $this->page),$_POST); if ($bootmenuForm->isValid($_POST)) { $bootmenuold = $bootmenu; $bootmenu = new Application_Model_BootMenu($_POST); - $bootmenu->setMembershipID($this->membership->getID()); $bootmenu->setGroupID($this->membership->getGroupID()); $bootmenu->setCreated(time()); $bootmenu->setID($bootmenuID); - //TODO ACL Is he allowed to edit this? - if(false) - $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/modifyresult/forbidden'); - try { $this->bootmenuMapper->save($bootmenu); }catch(Zend_Exception $e) @@ -212,8 +206,8 @@ class user_BootmenuController extends Zend_Controller_Action public function deletebootmenuAction() { - //TODO ACL Is he allowed to delete Bootmenu? - if(false) + //ACL Is he allowed to delete Bootmenu? + if(!Pbs_Acl::checkRight('bood')) $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/deleteresult/forbidden'); try{ @@ -240,8 +234,8 @@ class user_BootmenuController extends Zend_Controller_Action public function addbootmenuentryAction() { - //TODO ACL Darf er BootMenuEntries erstellen? - if(false) + //ACL Darf er BootMenuEntries erstellen? + if(!Pbs_Acl::checkRight('booae')) $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/addresult/forbidden'); $bootmenuID = $this->_request->getParam('bootmenuID'); @@ -255,6 +249,9 @@ class user_BootmenuController extends Zend_Controller_Action $bootoslist = $bootosMapper->fetchAll(); $configlist = $configMapper->fetchAll(); + if($this->membership->getGroupID() != $this->bootmenuMapper->find($bootmenuID)->getGroupID()) + $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/modifyresult/forbidden'); + if (!isset($_POST["addbootmenuentry"])){ $bootmenuentryForm = new user_Form_BootmenuEntries(array( @@ -262,8 +259,7 @@ class user_BootmenuController extends Zend_Controller_Action 'maxorder'=> $maxorder, 'configlist'=> $configlist, 'page' => $this->page, - 'action' => 'addbootmenuentry', - 'rights' => 'meta' + 'action' => 'addbootmenuentry' )); $bootmenuentryForm->populate(array('order' => $maxorder)); @@ -278,8 +274,7 @@ class user_BootmenuController extends Zend_Controller_Action 'maxorder'=> $maxorder, 'configlist'=>$configlist, 'page' => $this->page, - 'action' => 'addbootmenuentry', - 'rights' => 'meta'),$_POST); + 'action' => 'addbootmenuentry'),$_POST); if ($bootmenuentryForm->isValid($_POST)) { @@ -312,8 +307,8 @@ class user_BootmenuController extends Zend_Controller_Action public function editbootmenuentryAction() { - //TODO ACL Is he allowed to edit BootMenus? - if(false) + //ACL Is he allowed to edit BootMenus? + if(!Pbs_Acl::checkRight('booee')) $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/modifyresult/forbidden'); $bootmenuentryID = $this->_request->getParam('bootmenuentryID'); @@ -344,7 +339,6 @@ class user_BootmenuController extends Zend_Controller_Action 'kcl' => $bootmenuentry->getKcl(), 'page' => $this->page, 'action' => 'editbootmenuentry', - 'rights' => 'all' )); if(!isset($_POST['configID'])){ @@ -363,8 +357,7 @@ class user_BootmenuController extends Zend_Controller_Action 'configlist'=> $configlist, 'kcl' => $bootmenuentry->getKcl(), 'page' => $this->page, - 'action' => 'editbootmenuentry', - 'rights' => 'all'),$_POST); + 'action' => 'editbootmenuentry'),$_POST); if ($bootmenuentryForm->isValid($_POST)) { @@ -378,8 +371,8 @@ class user_BootmenuController extends Zend_Controller_Action $bootmenuentryold->getConfigID() != $bootmenuentry->getConfigID() || $bootmenuentryold->getKcl() != $bootmenuentry->getKcl() || $bootmenuentryold->getKclappend() != $bootmenuentry->getKclappend()){ - //TODO ACL Is he allowed to edit this? - if(false) + //ACL Is he allowed to edit this? + if(Pbs_Acl::checkRight('booeem')) $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/modifyresult/forbidden'); } @@ -410,8 +403,8 @@ class user_BootmenuController extends Zend_Controller_Action public function removebootmenuentryAction() { - //TODO ACL Is he allowed to delete Bootos? - if(false) + //ACL Is he allowed to delete Bootos? + if(!Pbs_Acl::checkRight('boode')) $this->_redirect('/user/bootmenu/index/page/'.$this->page.'/deleteresult/forbidden'); try{ -- cgit v1.2.3-55-g7522 From 3def9f74091e1b8616ad2e1870574705e73fc1b1 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Apr 2011 16:27:13 +0200 Subject: Suche gefixt & Neues Recht für Session --- application/modules/user/controllers/BootisoController.php | 2 +- application/modules/user/controllers/BootmenuController.php | 2 +- application/modules/user/controllers/BootosController.php | 2 +- application/modules/user/controllers/ClientController.php | 2 +- application/modules/user/controllers/ConfigController.php | 2 +- application/modules/user/controllers/FilterController.php | 2 +- application/modules/user/controllers/PoolController.php | 2 +- application/modules/user/controllers/SessionController.php | 12 +++++++++++- library/Pbs/Search.php | 2 +- pbs.sql | 7 ++++++- public/media/css/style.css | 5 +++++ 11 files changed, 30 insertions(+), 10 deletions(-) diff --git a/application/modules/user/controllers/BootisoController.php b/application/modules/user/controllers/BootisoController.php index 5c3acaa..654e7eb 100644 --- a/application/modules/user/controllers/BootisoController.php +++ b/application/modules/user/controllers/BootisoController.php @@ -84,11 +84,11 @@ class user_BootisoController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('bootiso'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $this->view->bootisolist = $mySearch->search($this->view->bootisolist); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/BootmenuController.php b/application/modules/user/controllers/BootmenuController.php index 84c31ff..cb7810b 100644 --- a/application/modules/user/controllers/BootmenuController.php +++ b/application/modules/user/controllers/BootmenuController.php @@ -92,11 +92,11 @@ class user_BootmenuController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('bootmenu'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $bootmenu = $mySearch->search($bootmenu); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/BootosController.php b/application/modules/user/controllers/BootosController.php index eeb60a7..12e2d68 100644 --- a/application/modules/user/controllers/BootosController.php +++ b/application/modules/user/controllers/BootosController.php @@ -71,11 +71,11 @@ class user_BootosController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('bootos'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $this->view->bootoslist = $mySearch->search($this->view->bootoslist); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/ClientController.php b/application/modules/user/controllers/ClientController.php index 9fe4b03..73c5279 100644 --- a/application/modules/user/controllers/ClientController.php +++ b/application/modules/user/controllers/ClientController.php @@ -54,11 +54,11 @@ class User_ClientController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('client'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $clientsInGroup = $mySearch->search($clientsInGroup); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php index ecc3c65..498e890 100644 --- a/application/modules/user/controllers/ConfigController.php +++ b/application/modules/user/controllers/ConfigController.php @@ -70,11 +70,11 @@ class user_ConfigController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('config'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $this->view->configlist = $mySearch->search($this->view->configlist); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/FilterController.php b/application/modules/user/controllers/FilterController.php index f84f501..e9850a9 100644 --- a/application/modules/user/controllers/FilterController.php +++ b/application/modules/user/controllers/FilterController.php @@ -61,11 +61,11 @@ class User_FilterController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('filter'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $allFilter = $mySearch->search($allFilter); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/PoolController.php b/application/modules/user/controllers/PoolController.php index 7800c7a..87f330a 100644 --- a/application/modules/user/controllers/PoolController.php +++ b/application/modules/user/controllers/PoolController.php @@ -70,11 +70,11 @@ class User_PoolController extends Zend_Controller_Action $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('pool'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $yourpools = $mySearch->search($yourpools); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php index 3c3c192..b027f63 100644 --- a/application/modules/user/controllers/SessionController.php +++ b/application/modules/user/controllers/SessionController.php @@ -23,6 +23,9 @@ class User_SessionController extends Zend_Controller_Action public function indexAction() { + if(!Pbs_Acl::checkRight('so')) + $this->_redirect('/user/index'); + $sessionMapper = new Application_Model_SessionMapper(); $bootisoMapper = new Application_Model_BootIsoMapper(); $bootosMapper = new Application_Model_BootOsMapper(); @@ -54,17 +57,22 @@ class User_SessionController extends Zend_Controller_Action $mySessions[] =$session; } } + // Sort after date/id + usort($mySessions, function($func_a, $func_b) { + if($func_a->getID() == $func_b->getID()) return 0; + return ($func_a->getID() < $func_b->getID()) ? -1 : 1; + }); // Search $search = $this->_request->getParam('search'); $mySearch = new Pbs_Search(); $mySearch->setSearchTerm($search); $mySearch->setModule('session'); - $this->view->searchform = $mySearch->searchForm(); if($search != ''){ $this->view->search = $mySearch->getSearchTerm(); $mySessions = $mySearch->search($mySessions); } + $this->view->searchform = $mySearch->searchForm(); // Pagination $pagination = new Pbs_Pagination(); @@ -79,6 +87,8 @@ class User_SessionController extends Zend_Controller_Action $this->view->sessions = $mySessions; } + + public function searchAction(){ $this->_redirect('/user/session/index/search/'.($_GET['search'])); diff --git a/library/Pbs/Search.php b/library/Pbs/Search.php index eb9d198..611c5e2 100644 --- a/library/Pbs/Search.php +++ b/library/Pbs/Search.php @@ -16,7 +16,7 @@ class Pbs_Search{ $highlight = array(); if($this->searchTerm != ''){ $str .= "Delete Client"; - $str .= "
$this->countresult results found in $this->countall
"; + $str .= "
$this->countresult result".(($this->countresult==1)?'':'s')." found
"; $str .=""; foreach($this->getSearchTerms() as $term){ $highlight[] = "$('table').highlight('".$term."');"; diff --git a/pbs.sql b/pbs.sql index 7f2bd52..dd81ea3 100644 --- a/pbs.sql +++ b/pbs.sql @@ -357,6 +357,7 @@ INSERT INTO `pbs_rightcategory` (`rightcategoryID`, `title`) VALUES (9, 'Client'), (10, 'Pool'), (11, 'Filter'); +(12, 'Session'); -- Insert rights INSERT INTO `pbs`.`pbs_right` (`rightID`, `rightcategoryID`, `shortcut`, `title`, `description`) VALUES @@ -551,9 +552,13 @@ INSERT INTO `pbs`.`pbs_right` (`rightID`, `rightcategoryID`, `shortcut`, `title` -- FilterEinträge löschen (NULL, '11', 'ffd', 'Delete Filterentry of a Filter', NULL); + -- Session + -- Session Übersicht ansehen +(NULL, '12', 'so', 'Show overview of Session', NULL), + -- Adding Super-User INSERT INTO `pbs`.`pbs_group` (`groupID` ,`title` ,`description`)VALUES (1, 'OpenSLX', 'This is the OpenSLX-Group'); INSERT INTO `pbs`.`pbs_role` (`roleID`, `groupID`, `title`, `description`, `inheritance`) VALUES (1, '1', 'SuperAdmin', 'The SuperAdmin', 0); INSERT INTO `pbs`.`pbs_rightroles` (`roleID`, `rightID`) VALUES -(1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(1, 6),(1, 7),(1, 8),(1, 9),(1, 10),(1, 11),(1, 12),(1, 13),(1, 14),(1, 15),(1, 16),(1, 17),(1, 18),(1, 19),(1, 20),(1, 21),(1, 22),(1, 23),(1, 24),(1, 25),(1, 26),(1, 27),(1, 28),(1, 29),(1, 30),(1, 31),(1, 32),(1, 33),(1, 34),(1, 35),(1, 36),(1, 37),(1, 38),(1, 39),(1, 40),(1, 41),(1, 42),(1, 43),(1, 44),(1, 45),(1, 46),(1, 47),(1, 48),(1, 49),(1, 50),(1, 51),(1, 52),(1, 53),(1, 54),(1, 55),(1, 56),(1, 57),(1, 58),(1, 59),(1, 60),(1, 61),(1, 62),(1, 63),(1, 64),(1, 65),(1, 66),(1, 67),(1, 68),(1, 69),(1, 70),(1, 71),(1, 72),(1, 73),(1, 74),(1, 75),(1, 76),(1, 77),(1, 78),(1, 79),(1, 80),(1, 81),(1, 82),(1, 83),(1, 84); +(1, 1),(1, 2),(1, 3),(1, 4),(1, 5),(1, 6),(1, 7),(1, 8),(1, 9),(1, 10),(1, 11),(1, 12),(1, 13),(1, 14),(1, 15),(1, 16),(1, 17),(1, 18),(1, 19),(1, 20),(1, 21),(1, 22),(1, 23),(1, 24),(1, 25),(1, 26),(1, 27),(1, 28),(1, 29),(1, 30),(1, 31),(1, 32),(1, 33),(1, 34),(1, 35),(1, 36),(1, 37),(1, 38),(1, 39),(1, 40),(1, 41),(1, 42),(1, 43),(1, 44),(1, 45),(1, 46),(1, 47),(1, 48),(1, 49),(1, 50),(1, 51),(1, 52),(1, 53),(1, 54),(1, 55),(1, 56),(1, 57),(1, 58),(1, 59),(1, 60),(1, 61),(1, 62),(1, 63),(1, 64),(1, 65),(1, 66),(1, 67),(1, 68),(1, 69),(1, 70),(1, 71),(1, 72),(1, 73),(1, 74),(1, 75),(1, 76),(1, 77),(1, 78),(1, 79),(1, 80),(1, 81),(1, 82),(1, 83),(1, 84),(1, 85); diff --git a/public/media/css/style.css b/public/media/css/style.css index 2057c54..0686eae 100644 --- a/public/media/css/style.css +++ b/public/media/css/style.css @@ -307,6 +307,11 @@ td { border: 1px solid #CCC; } +div.searchresult { + margin-left:10px; + font-size:10px; +} + .updatebutton,.addbutton { float: right; } -- cgit v1.2.3-55-g7522 From e13feb35a7e488e9d88282a57308bf2314fc2457 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Apr 2011 16:52:17 +0200 Subject: Neue Rechte für Übersicht von Rollen, Layout an Rechte angepasst --- .../modules/user/controllers/SessionController.php | 4 +-- application/modules/user/layouts/user.phtml | 40 ++++++++++++++-------- pbs.sql | 2 ++ 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/application/modules/user/controllers/SessionController.php b/application/modules/user/controllers/SessionController.php index b027f63..d149f22 100644 --- a/application/modules/user/controllers/SessionController.php +++ b/application/modules/user/controllers/SessionController.php @@ -76,7 +76,7 @@ class User_SessionController extends Zend_Controller_Action // Pagination $pagination = new Pbs_Pagination(); - $pagination->setPerPage(3); + $pagination->setPerPage(10); $pagination->setElement($mySessions); $pagination->setRequestPage($this->_request->getParam('page')); $pagination->setPageUrl('/user/session/index'.((isset($this->view->search))?'/search/'.$this->view->search:'')); @@ -87,8 +87,6 @@ class User_SessionController extends Zend_Controller_Action $this->view->sessions = $mySessions; } - - public function searchAction(){ $this->_redirect('/user/session/index/search/'.($_GET['search'])); diff --git a/application/modules/user/layouts/user.phtml b/application/modules/user/layouts/user.phtml index 14ce235..7d80d38 100644 --- a/application/modules/user/layouts/user.phtml +++ b/application/modules/user/layouts/user.phtml @@ -28,20 +28,32 @@ echo $this->headScript()."\n";