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/BootmenuController.php | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
(limited to 'application/modules/user/controllers/BootmenuController.php')
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);
--
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(-)
(limited to 'application/modules/user/controllers/BootmenuController.php')
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(-)
(limited to 'application/modules/user/controllers/BootmenuController.php')
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 .= "
";
- $str .= "