summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--application/configs/application.ini.dist2
-rw-r--r--application/controllers/AuthController.php126
-rw-r--r--application/controllers/EventController.php57
-rw-r--r--application/controllers/PersonController.php91
-rw-r--r--application/forms/NewPassword.php48
-rw-r--r--application/forms/RecoverPassword.php38
-rw-r--r--application/layouts/default.phtml189
-rw-r--r--application/models/DbTable/Group.php20
-rw-r--r--application/models/DbTable/GroupGroups.php20
-rw-r--r--application/models/DbTable/PasswordRecovery.php20
-rw-r--r--application/models/DbTable/Person.php20
-rw-r--r--application/models/GroupGroupsMapper.php171
-rw-r--r--application/models/GroupMapper.php144
-rw-r--r--application/models/PasswordRecoveryMapper.php145
-rw-r--r--application/models/PersonMapper.php198
-rw-r--r--application/models/Right.php139
-rw-r--r--application/models/RightCategory.php (renamed from application/models/PasswordRecovery.php)36
-rw-r--r--application/models/RightRoles.php (renamed from application/models/GroupGroups.php)26
-rw-r--r--application/models/Role.php139
-rw-r--r--application/views/scripts/auth/login.phtml3
-rw-r--r--application/views/scripts/auth/recoverpassword.phtml5
-rw-r--r--setup/poolctrl.sql63
-rw-r--r--setup/poolctrl_data.sql53
23 files changed, 518 insertions, 1235 deletions
diff --git a/application/configs/application.ini.dist b/application/configs/application.ini.dist
index 0852ec9..4ef9da7 100644
--- a/application/configs/application.ini.dist
+++ b/application/configs/application.ini.dist
@@ -23,6 +23,8 @@ pbs2.addbootmenu = /resource/addbootmenu/apikey/
pbs2.deletebootmenu = /resource/deletebootmenu/apikey/
pbs2.addfilter = /resource/addfilter/apikey/
pbs2.deletefilter = /resource/deletefilter/apikey/
+pbs2.getperson = /resource/getperson/apikey/
+pbs2.getgroup = /resource/getgroup/apikey/
resources.layout.layout = "default"
resources.layout.layoutPath = APPLICATION_PATH "/layouts"
diff --git a/application/controllers/AuthController.php b/application/controllers/AuthController.php
index 983a340..8709cbe 100644
--- a/application/controllers/AuthController.php
+++ b/application/controllers/AuthController.php
@@ -12,7 +12,6 @@
class AuthController extends Zend_Controller_Action
{
- protected $personmapper = null;
private $db = null;
protected $config;
protected $pbs2host;
@@ -23,7 +22,6 @@ class AuthController extends Zend_Controller_Action
$this->config = $bootstrap->getOptions();
$this->pbs2host = $this->config['pbs2']['host'];
$this->db = Zend_Db_Table::getDefaultAdapter();
- $this->personmapper = new Application_Model_PersonMapper();
}
public function indexAction()
@@ -50,7 +48,6 @@ class AuthController extends Zend_Controller_Action
$login = $loginXML->login;
$success = sprintf("%s", $login->success);
if ($success === "true") {
- $personid = sprintf("%s", $login->personid);
$membershipSession = new Zend_Session_Namespace('memberships');
$count = 0;
foreach($login->membershiplist->membership as $membershipXML)
@@ -62,24 +59,9 @@ class AuthController extends Zend_Controller_Action
$membershipSession->$count = $membership;
$count++;
}
-
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personid);
- $person->setEmail($loginForm->getValue('email'));
- $person->setPassword($loginForm->getValue('password'));
- $person->setSuspend(0);
- $date = new DateTime();
- $person->setLogindate($date->getTimestamp());
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
+
$authSession = new Zend_Session_Namespace('auth');
- $authSession->storage = $person->getEmail();
+ $authSession->storage = $loginForm->getValue('email');
$this->_helper->redirector('selectmembership', 'person');
return;
} else {
@@ -88,20 +70,6 @@ class AuthController extends Zend_Controller_Action
$poolctrlNotifier = new Poolctrl_Notifier();
$this->view->notification = $poolctrlNotifier->notify('Wrong Email or Password', 'error');
} else if($error == "person suspended") {
- $personid = sprintf("%s", $login->personid);
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personid);
- $person->setEmail($loginForm->getValue('email'));
- $person->setPassword($loginForm->getValue('password'));
- $person->setSuspend(1);
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
$poolctrlNotifier = new Poolctrl_Notifier();
$this->view->notification = $poolctrlNotifier->notify('Your Account is suspended', 'error');
}
@@ -124,94 +92,4 @@ class AuthController extends Zend_Controller_Action
$this->_helper->redirector('login', 'auth');
return;
}
-
- public function recoverpasswordAction()
- {
- if (isset($_POST["savePassword"])){
- $personID = $_POST['personID'];
- $recoverPasswordForm = new Application_Form_NewPassword(array("personID" => $personID, $_POST));
- if ($recoverPasswordForm->isValid($_POST)) {
- $this->personmapper = new Application_Model_PersonMapper();
- $person = $this->personmapper->find($personID);
- $date = new DateTime();
- $person->setPassword($_POST['password'])
- ->setPasswordSalt(MD5($date->getTimestamp()))
- ->setLoginPassword(crypt($person->getPassword(), '$6$'.randomString(8).'$'))
- ->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
- try {
- $this->personmapper->save($person);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- echo "Email Address already existing.";
- return;
- }
- $this->_helper->redirector('login', 'auth');
- return;
- }
- } else if(isset($_GET['recoveryid'])) {
- $recoveryid = $_GET['recoveryid'];
- $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
- $passwordRecovery = $passwordRecoveryMapper->findBy(array("recoveryID" => $recoveryid),true);
- if(count($passwordRecovery) > 0) {
- $passwordRecoveryObject = new Application_Model_PasswordRecovery();
- $passwordRecoveryObject->setID($passwordRecovery[0]['personID']);
- $passwordRecoveryObject->setRecoveryID($passwordRecovery[0]['recoveryID']);
- $personID = $passwordRecoveryObject->getID();
- $recoverPasswordForm = new Application_Form_NewPassword(array("personID" => $personID));
- try {
- $passwordRecoveryMapper->delete($passwordRecoveryObject);
- } catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- } else {
- $this->_helper->redirector('login', 'auth');
- return;
- }
- } else {
- if (!isset($_POST["recoverPassword"])){
- $recoverPasswordForm = new Application_Form_RecoverPassword();
- } else {
- $recoverPasswordForm = new Application_Form_RecoverPassword($_POST);
- if ($recoverPasswordForm->isValid($_POST)) {
- $recoverPasswordForm->getView()->url();
- $this->personmapper = new Application_Model_PersonMapper();
- $result = $this->personmapper->findBy(array('email' => $_POST['email']),true);
- $person = new Application_Model_Person($result[0]);
- $person->setID($result[0]['personID']);
- $email = $person->getEmail();
- $name = $person->getFirstname() . ' ' . $person->getName();
- $url = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->view->url();
- $recoveryid = randomString(100);
- $mailbody = 'Um das Passwort zu ändern klicken Sie auf folgenden Link<br /><br /><a href="'. $url . '/auth/recoverpassword/?recoveryid='. $recoveryid . '">Passwort ändern</a>';
- $mail = new Zend_Mail();
- $mail->setBodyHtml($mailbody, 'utf8')
- ->getBodyHtml()->getContent()
- ->setFrom('admin@local', 'Admin')
- ->addTo($email, $name)
- ->setSubject('Password Wiederherstellung Preboot Server');
- $passwordRecoveryMapper = new Application_Model_PasswordRecoveryMapper();
- $passwordRecoveryObject = new Application_Model_PasswordRecovery();
- $passwordRecoveryObject->setID($person->getID())
- ->setRecoveryID($recoveryid);
- try {
- $passwordRecoveryMapper->save($passwordRecoveryObject);
- $mail->send();
- }catch(Zend_Exception $e)
- {
- echo "Caught exception: " . get_class($e) . "<br/>";
- echo "Message: " . $e->getMessage() . "<br/>";
- return;
- }
- $this->_helper->redirector('login', 'auth');
- return;
- }
- }
- }
- $this->view->recoverPasswordForm = $recoverPasswordForm;
- }
}
diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php
index 553ab95..f3a5f50 100644
--- a/application/controllers/EventController.php
+++ b/application/controllers/EventController.php
@@ -16,7 +16,6 @@ class EventController extends Zend_Controller_Action
protected $eventcategoryMapper;
protected $eventactionMapper;
protected $membershipMapper;
- protected $personMapper;
protected $config;
protected $pbs2host;
protected $userIDsNamespace;
@@ -30,7 +29,6 @@ class EventController extends Zend_Controller_Action
$this->eventcategoryMapper = new Application_Model_EventcategoryMapper();
$this->eventactionMapper = new Application_Model_EventactionMapper();
$this->membershipMapper = new Application_Model_MembershipMapper();
- $this->personMapper = new Application_Model_PersonMapper();
$bootstrap = $this->getInvokeArg('bootstrap');
$this->config = $bootstrap->getOptions();
$this->pbs2host = $this->config['pbs2']['host'];
@@ -91,9 +89,26 @@ class EventController extends Zend_Controller_Action
$event['pbs_bootos_title'] = $bootoslist[$event['pbs_bootosID']]->getTitle();
$membership = new Application_Model_Membership();
$this->membershipMapper->find($event['pbs_membershipID'], $membership);
- $person = new Application_Model_Person();
- $this->personMapper->find($membership->getPersonID(), $person);
- $event['pbs_person_name'] = $person->getFirstname() . " " . $person->getName();
+ $personApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getperson'] . $membership->getApikey(), 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
+ $personXMLString = $personApiResult['http-body'];
+ if(strlen($personXMLString) > 0) {
+ $personXML = new SimpleXMLElement($personXMLString);
+ $person = new Application_Model_Person();
+ $person->setID(sprintf("%s", $personXML->person->id));
+ $person->setCity(sprintf("%s", $personXML->person->city));
+ $person->setEmail(sprintf("%s", $personXML->person->email));
+ $person->setFirstname(sprintf("%s", $personXML->person->firstname));
+ $person->setHousenumber(sprintf("%s", $personXML->person->housenumber));
+ $person->setLogin(sprintf("%s", $personXML->person->login));
+ $person->setLogindate(sprintf("%s", $personXML->person->logindate));
+ $person->setName(sprintf("%s", $personXML->person->name));
+ $person->setPostalcode(sprintf("%s", $personXML->person->postalcode));
+ $person->setRegisterdate(sprintf("%s", $personXML->person->registerdate));
+ $person->setStreet(sprintf("%s", $personXML->person->street));
+ $person->setSuspend(sprintf("%s", $personXML->person->suspend));
+ $person->setTitle(sprintf("%s", $personXML->person->title));
+ $event['pbs_person_name'] = $person->getFirstname() . " " . $person->getName();
+ }
$eventcategory = new Application_Model_Eventcategory();
$eventaction = new Application_Model_Eventaction();
$this->eventcategoryMapper->find($event['category'], $eventcategory);
@@ -315,34 +330,34 @@ class EventController extends Zend_Controller_Action
$this->view->params = $params;
}
}
-
+
public function listAction() {
-
- $this->_helper->layout->disableLayout();
- $this->_helper->viewRenderer->setNoRender();
-
+
+ $this->_helper->layout->disableLayout();
+ $this->_helper->viewRenderer->setNoRender();
+
$year = date('Y');
$month = date('m');
-
+
echo json_encode(array(
-
- array(
+
+ array(
'id' => 111,
'title' => "Event1",
'start' => "$year-$month-10",
'end' => "$year-$month-11",
'url' => "http://yahoo.com/"
- ),
-
- array(
+ ),
+
+ array(
'id' => 222,
'title' => "Event2",
'start' => "$year-$month-20",
'end' => "$year-$month-22",
'url' => "http://yahoo.com/"
- )
-
- ));
- return;
- }
+ )
+
+ ));
+ return;
+ }
} \ No newline at end of file
diff --git a/application/controllers/PersonController.php b/application/controllers/PersonController.php
index d113d2f..47cb674 100644
--- a/application/controllers/PersonController.php
+++ b/application/controllers/PersonController.php
@@ -12,44 +12,66 @@
class PersonController extends Zend_Controller_Action
{
-
protected $person = null;
- protected $personmapper = null;
protected $membershipMapper = null;
+ protected $currentMembership = null;
protected $memberships = null;
- protected $groupMapper = null;
- protected $groups = null;
protected $userIDsNamespace = null;
public function init()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
- $this->personmapper = new Application_Model_PersonMapper();
$this->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
- if(isset($this->userIDsNamespace['personID'])) {
- $this->person = $this->personmapper->find($this->userIDsNamespace['personID']);
- } else {
- $result = $this->personmapper->findBy(array('email' => Zend_Auth::getInstance()->getIdentity()),true);
- $this->person = new Application_Model_Person($result[0]);
- $this->person->setID($result[0]['personID']);
+ $membershipID = $this->userIDsNamespace['membershipID'];
+ if(!isset($membershipID)) {
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
}
- $this->groupMapper = new Application_Model_GroupMapper();
+ $this->currentMembership = new Application_Model_Membership();
$this->membershipMapper = new Application_Model_MembershipMapper();
+ $this->membershipMapper->find($membershipID, $this->currentMembership);
+ $personApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getperson'] . $this->currentMembership->getApikey(), 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
+ $personXMLString = $personApiResult['http-body'];
+ if(strlen($personXMLString) > 0) {
+ $personXML = new SimpleXMLElement($personXMLString);
+ $this->person = new Application_Model_Person();
+ $this->person->setID(sprintf("%s", $personXML->person->id));
+ $this->person->setCity(sprintf("%s", $personXML->person->city));
+ $this->person->setEmail(sprintf("%s", $personXML->person->email));
+ $this->person->setFirstname(sprintf("%s", $personXML->person->firstname));
+ $this->person->setHousenumber(sprintf("%s", $personXML->person->housenumber));
+ $this->person->setLogin(sprintf("%s", $personXML->person->login));
+ $this->person->setLogindate(sprintf("%s", $personXML->person->logindate));
+ $this->person->setName(sprintf("%s", $personXML->person->name));
+ $this->person->setPostalcode(sprintf("%s", $personXML->person->postalcode));
+ $this->person->setRegisterdate(sprintf("%s", $personXML->person->registerdate));
+ $this->person->setStreet(sprintf("%s", $personXML->person->street));
+ $this->person->setSuspend(sprintf("%s", $personXML->person->suspend));
+ $this->person->setTitle(sprintf("%s", $personXML->person->title));
+ }
$this->memberships = Zend_Session::namespaceGet('memberships');
-
$this->view->apikeys = array();
if(isset($this->memberships)) {
foreach($this->memberships as $membership) {
- $group = $this->groupMapper->find($membership['groupID']);
- $this->view->apikeys[$group->getID()] = $membership['apikey'];
- $this->groups[] = array (
+ $groupApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getgroup'] . $membership['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
+ $groupXMLString = $groupApiResult['http-body'];
+ if(strlen($groupXMLString) > 0) {
+ $groupXML = new SimpleXMLElement($groupXMLString);
+ $group = new Application_Model_Group();
+ $group->setID($groupXML->group->id);
+ $group->setTitle($groupXML->group->title);
+ $group->setDescription($groupXML->group->description);
+
+ $this->view->apikeys[$group->getID()] = $membership['apikey'];
+ $this->groups[] = array (
'groupID' => $group->getID(),
'title' => $group->getTitle(),
'description' => $group->getDescription(),
'membershipID' => $membership['membershipID'],
- );
+ );
+ }
}
}
} else {
@@ -89,28 +111,35 @@ class PersonController extends Zend_Controller_Action
$this->_redirect('/');
return;
} else {
- $groupMapper = new Application_Model_GroupMapper();
if(isset($this->memberships)) {
$suspendlist = array();
foreach($this->memberships as $membership) {
- $group = $groupMapper->find($membership['groupID']);
- if($membership['suspend'] == 0){
- $membershipList[] = array(
+ $groupApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getgroup'] . $membership['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
+ $groupXMLString = $groupApiResult['http-body'];
+ if(strlen($groupXMLString) > 0) {
+ -$groupXML = new SimpleXMLElement($groupXMLString);
+ $group = new Application_Model_Group();
+ $group->setID($groupXML->group->id);
+ $group->setTitle($groupXML->group->title);
+ $group->setDescription($groupXML->group->description);
+ if($membership['suspend'] == 0){
+ $membershipList[] = array(
'membershipID' => $membership['membershipID'],
'group' => $group->getTitle()
- );
- }
- else{
- $suspendlist[] = array(
+ );
+ }
+ else{
+ $suspendlist[] = array(
'membershipID' => $membership['membershipID'],
'group' => $group->getTitle()
- );
- }
+ );
+ }
- }
- if(count($suspendlist) >=1){
- $poolNotifier = new Poolctrl_Notifier();
- $this->view->notification = $poolNotifier->notify("Actually ".count($suspendlist)." Memberships are suspended", 'error' );
+ }
+ if(count($suspendlist) >=1){
+ $poolNotifier = new Poolctrl_Notifier();
+ $this->view->notification = $poolNotifier->notify("Actually ".count($suspendlist)." Memberships are suspended", 'error' );
+ }
}
}
$membershipSelectForm = new Application_Form_MembershipSelect(array('membershiplist' => $membershipList));
diff --git a/application/forms/NewPassword.php b/application/forms/NewPassword.php
deleted file mode 100644
index d3ca34b..0000000
--- a/application/forms/NewPassword.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Form_NewPassword extends Zend_Form
-{
- private $personID;
-
- public function setPersonID($personID){
- $this->personID = $personID;
- }
-
- public function init()
- {
- $this->setName("NewPassword");
- $this->setMethod('post');
-
- $this->addElement('hidden', 'personID', array(
- 'value' => $this->personID
- ));
-
- $this->addElement('password', 'password', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
- 'required' => true,
- 'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'savePassword', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Save',
- ));
- }
-
-
-}
-
diff --git a/application/forms/RecoverPassword.php b/application/forms/RecoverPassword.php
deleted file mode 100644
index 273b426..0000000
--- a/application/forms/RecoverPassword.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Appliocation_Form_RecoverPassword extends Zend_Form
-{
-
- public function init()
- {
- $this->setName("RecoverPassword");
- $this->setMethod('post');
-
- $this->addElement('text', 'email', array(
- 'filters' => array('StringTrim'),
- 'validators' => array(
- array('StringLength', false, array(0, 30)),
- ),
- 'required' => true,
- 'label' => 'Email:',
- ));
- $this->addElement('submit', 'recoverPassword', array(
- 'required' => false,
- 'ignore' => true,
- 'label' => 'Recover',
- ));
- }
-
-
-}
-
diff --git a/application/layouts/default.phtml b/application/layouts/default.phtml
index e2c414e..a4cd82f 100644
--- a/application/layouts/default.phtml
+++ b/application/layouts/default.phtml
@@ -13,110 +13,119 @@ echo $this->headScript()."\n";
?>
<script type="text/javascript" src='/media/js/jquery.min.js'></script>
<script type="text/javascript" src='/media/js/jquery-ui.min.js'></script>
-<script type="text/javascript" src='/media/js/jquery-ui-timepicker-addon.js'></script>
+<script type="text/javascript"
+ src='/media/js/jquery-ui-timepicker-addon.js'></script>
<script type="text/javascript" src='/media/js/script.js'></script>
<script type="text/javascript" src='/media/js/user.js'></script>
<!-- files for calendar -->
<script type='text/javascript' src='/media/js/jquery-1.5.2.min.js'></script>
-<script type='text/javascript' src='/media/js/jquery-ui-1.8.11.custom.min.js'></script>
+<script type='text/javascript'
+ src='/media/js/jquery-ui-1.8.11.custom.min.js'></script>
<script type='text/javascript' src='/media/js/fullcalendar.min.js'></script>
</head>
<body>
<div id='sidepannel'>
- <div id="logo">
- <div id="logo-bar-gray"></div>
- </div>
- <div id="sidepannel-top" class='portletNavigationTree'>
- <ul class='navTreeLevel0'>
- <li class='navTreeItem'><a href='/'>Home</a></li>
- <?php if(Zend_Auth::getInstance()->hasIdentity()) { ?>
- <li class='navTreeItem'><a href='/person/'>Own Details</a></li>
- <?php if(count(Zend_Session::namespaceGet('userIDs')) > 0) { ?>
- <li class='navTreeItem'><a href='/event'>Event</a></li>
- <li class='navTreeItem'><a href='/person/changemembership'>Change Membership</a></li>
- <?php } else { ?>
- <li class='navTreeItem'><a href='/person/selectmembership'>Select Membership</a></li>
- <?php } ?>
- <li class='navTreeItem'><a href='/gearman'>Gearman</a></li>
- <li class='navTreeItem'><a href='/auth/logout'>Logout</a></li>
- <?php } else { ?>
- <li class='navTreeItem'><a href='/auth/login'>Login</a></li>
- <?php } ?>
- </ul>
- </div>
+<div id="logo">
+<div id="logo-bar-gray"></div>
+</div>
+<div id="sidepannel-top" class='portletNavigationTree'>
+<ul class='navTreeLevel0'>
+ <li class='navTreeItem'><a href='/'>Home</a></li>
+ <?php if(Zend_Auth::getInstance()->hasIdentity()) { ?>
+ <li class='navTreeItem'><a href='/person/'>Own Details</a></li>
+ <?php if(count(Zend_Session::namespaceGet('userIDs')) > 0) { ?>
+ <li class='navTreeItem'><a href='/event'>Event</a></li>
+ <li class='navTreeItem'><a href='/person/changemembership'>Change
+ Membership</a></li>
+ <?php } else { ?>
+ <li class='navTreeItem'><a href='/person/selectmembership'>Select
+ Membership</a></li>
+ <?php } ?>
+ <li class='navTreeItem'><a href='/gearman'>Gearman</a></li>
+ <li class='navTreeItem'><a href='/auth/logout'>Logout</a></li>
+ <?php } else { ?>
+ <li class='navTreeItem'><a href='/auth/login'>Login</a></li>
+ <?php } ?>
+</ul>
+</div>
</div>
<div id='main'>
- <div id="head-bg">
- <div id="head">
- <h1>poolctrl</h1>
- <h2>Rechenzentrum Universit&auml;t Freiburg</h2>
- </div>
- </div>
- <div id="logo-bar-red"></div>
- <div id="head-titlebar">
- <div style='float: right'><?php
- if(Zend_Auth::getInstance()->hasIdentity()){
- echo 'Logged in as';
- $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
-
- if(isset($userIDsNamespace['membershipID'])){
- $membershipMapper = new Application_Model_MembershipMapper();
- $membership = new Application_Model_Membership();
- $membershipMapper->find($userIDsNamespace['membershipID'],$membership);
- }
- if(isset($userIDsNamespace['personID'])){
- $person = new Application_Model_Person();
- $personMapper = new Application_Model_PersonMapper();
- $personMapper->find($userIDsNamespace['personID'],$person);
- echo "<b><i>".$person->getFirstname()." ".$person->getName()."</i></b>";
- }
- if(isset($userIDsNamespace['roleID'])){
- echo " in role ";
-
- $role = new Application_Model_Role();
- $roleMapper = new Application_Model_RoleMapper();
- $role = $roleMapper->find($userIDsNamespace['roleID']);
- echo "<b><i>".$role->getTitle()."</i></b>";
- }
- if(isset($userIDsNamespace['groupID'])){
- echo " in group ";
- $group = new Application_Model_Group();
- $groupMapper = new Application_Model_GroupMapper();
- $group = $groupMapper->find($userIDsNamespace['groupID']);
- echo "<b><i>".$group->getTitle()."</i></b>";
- }
+<div id="head-bg">
+<div id="head">
+<h1>poolctrl</h1>
+<h2>Rechenzentrum Universit&auml;t Freiburg</h2>
+</div>
+</div>
+<div id="logo-bar-red"></div>
+<div id="head-titlebar">
+<div style='float: right'><?php
+if(Zend_Auth::getInstance()->hasIdentity()){
+ echo 'Logged in as';
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+
+ if(isset($userIDsNamespace['membershipID'])){
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $membership = new Application_Model_Membership();
+ $membershipMapper->find($userIDsNamespace['membershipID'],$membership);
+ }
+ if(isset($userIDsNamespace['personID'])){
+ $personApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getperson'] . $userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
+ $personXMLString = $personApiResult['http-body'];
+ if(strlen($personXMLString) > 0) {
+ $personXML = new SimpleXMLElement($personXMLString);
+ $person = new Application_Model_Person();
+ $person->setID(sprintf("%s", $personXML->person->id));
+ $person->setCity(sprintf("%s", $personXML->person->city));
+ $person->setEmail(sprintf("%s", $personXML->person->email));
+ $person->setFirstname(sprintf("%s", $personXML->person->firstname));
+ $person->setHousenumber(sprintf("%s", $personXML->person->housenumber));
+ $person->setLogin(sprintf("%s", $personXML->person->login));
+ $person->setLogindate(sprintf("%s", $personXML->person->logindate));
+ $person->setName(sprintf("%s", $personXML->person->name));
+ $person->setPostalcode(sprintf("%s", $personXML->person->postalcode));
+ $person->setRegisterdate(sprintf("%s", $personXML->person->registerdate));
+ $person->setStreet(sprintf("%s", $personXML->person->street));
+ $person->setSuspend(sprintf("%s", $personXML->person->suspend));
+ $person->setTitle(sprintf("%s", $personXML->person->title));
+ echo "<b><i>".$person->getFirstname()." ".$person->getName()."</i></b>";
+ }
+ }
+ if(isset($userIDsNamespace['groupID'])){
+ echo " in group ";
+ $groupApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getgroup'] . $userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', '');
+ $groupXMLString = $groupApiResult['http-body'];
+ if(strlen($groupXMLString) > 0) {
+ $groupXML = new SimpleXMLElement($groupXMLString);
+ $group = new Application_Model_Group();
+ $group->setID($groupXML->group->id);
+ $group->setTitle($groupXML->group->title);
+ $group->setDescription($groupXML->group->description);
+ echo "<b><i>".$group->getTitle()."</i></b>";
}
- ?>
- </div>
- <?php
- echo ucwords($request->getControllerName()) . " > " . ucwords($request->getActionName());
- ?>
- </div>
- <div id="content"><?php echo $this->layout()->content; ?></div>
- <div id="footer" class="footer flexbox flex">
- <div style='padding: 5px;'>
- <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">
- display Debug
- </a>
- // <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i>
- // <i>version: 0.1.1</i>
- </div>
- </div>
+ }
+}
+?></div>
+<?php
+echo ucwords($request->getControllerName()) . " > " . ucwords($request->getActionName());
+?></div>
+<div id="content"><?php echo $this->layout()->content; ?></div>
+<div id="footer" class="footer flexbox flex">
+<div style='padding: 5px;'><a
+ onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> display
+Debug </a> // <i>last edit: <?php echo date("m\/Y",filectime('index.php'));?></i>
+// <i>version: 0.1.1</i></div>
+</div>
</div>
<div id='debug'>
- <div class='v1'>
- <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">
- <img alt="down" src='/media/img/down.png' />
- </a>
- </div>
- <div class='v2' style='display: none;'>
- <div style='text-align: right;'>
- <a onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();">
- <img alt="up" src='/media/img/up.png' />
- </a>
- </div>
- <?php print_a('Session',$_SESSION,'GET',$_GET,'POST',$_POST); ?></div>
+<div class='v1'><a
+ onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> <img
+ alt="down" src='/media/img/down.png' /> </a></div>
+<div class='v2' style='display: none;'>
+<div style='text-align: right;'><a
+ onclick="$('#debug .v1').toggle();$('#debug .v2').toggle();"> <img
+ alt="up" src='/media/img/up.png' /> </a></div>
+<?php print_a('Session',$_SESSION,'GET',$_GET,'POST',$_POST); ?></div>
</div>
</body>
</html>
diff --git a/application/models/DbTable/Group.php b/application/models/DbTable/Group.php
deleted file mode 100644
index d31d93a..0000000
--- a/application/models/DbTable/Group.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_Group extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_group';
-
-
-}
-
diff --git a/application/models/DbTable/GroupGroups.php b/application/models/DbTable/GroupGroups.php
deleted file mode 100644
index bd7c7c4..0000000
--- a/application/models/DbTable/GroupGroups.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_GroupGroups extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_groupgroups';
-
-
-}
-
diff --git a/application/models/DbTable/PasswordRecovery.php b/application/models/DbTable/PasswordRecovery.php
deleted file mode 100644
index b4e5082..0000000
--- a/application/models/DbTable/PasswordRecovery.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_PasswordRecovery extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_passwordrecovery';
-
-
-}
-
diff --git a/application/models/DbTable/Person.php b/application/models/DbTable/Person.php
deleted file mode 100644
index 132e8b6..0000000
--- a/application/models/DbTable/Person.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_DbTable_Person extends Zend_Db_Table_Abstract
-{
-
- protected $_name = 'pbs_person';
-
-
-}
-
diff --git a/application/models/GroupGroupsMapper.php b/application/models/GroupGroupsMapper.php
deleted file mode 100644
index 318b298..0000000
--- a/application/models/GroupGroupsMapper.php
+++ /dev/null
@@ -1,171 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_GroupGroupsMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_GroupGroups($row);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_GroupGroups');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_GroupGroups $groupgroups)
- {
-
- $data = array('parentID'=> $groupgroups->getParentID() ,'groupID'=> $groupgroups->getGroupID() );
-
- #Noch zu prüfen ob Eintrag schon vorhanden
- $this->getDbTable()->insert($data);
- }
-
- public function delete(Application_Model_GroupGroups $groupgroups)
- {
- if (null === ($id = $groupgroups->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('groupgroupsID = ?' => $id));
- }
- }
-
- public function find($id, Application_Model_GroupGroups $groupgroups)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $groupgroups->setParentID($row->parentID)->setGroupID($row->groupID);
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_GroupGroups();
-
- $entry->setParentID($row->parentID)->setGroupID($row->groupID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
- private $crawledNodes;
- // Gets All groupIDs of the parent groups begins with the
- public function getParentGroups($groupID, &$data=null, $level=0) {
- if(isset($this->crawledNodes['parent'][$groupID]) && $this->crawledNodes['parent'][$groupID] == 1)
- return $data;
- $this->crawledNodes['parent'][$groupID] = 1;
-
- $data[$level][] = $groupID;
- $db = Zend_Db_Table::getDefaultAdapter();
- $query = 'SELECT parentID FROM pbs_groupgroups WHERE groupID="'.$groupID.'"';
- $stmt = $db->query($query);
- $result = $stmt->fetchAll();
- foreach($result as $row){
- // get the function recursive an increase the level
- $data = $this->getParentGroups($row['parentID'], $data, $level+1);
- }
- return $data;
- }
- // Gets all childs-groups from a given group
- public function getChildGroups($groupID, &$data=null, $level=0) {
- if(isset($this->crawledNodes['child'][$groupID]) && $this->crawledNodes['child'][$groupID] == 1)
- return $data;
- $this->crawledNodes['child'][$groupID] = 1;
- $data[$level][] = $groupID;
- $db = Zend_Db_Table::getDefaultAdapter();
- $query = 'SELECT groupID FROM pbs_groupgroups WHERE parentID="'.$groupID.'"';
- $stmt = $db->query($query);
- $result = $stmt->fetchAll();
- foreach($result as $row){
- // get the function recursive an increase the level
- $data = $this->getChildGroups($row['groupID'], $data, $level+1);
- }
- return $data;
- }
-
- public function compare(Application_Model_GroupGroups $v1,Application_Model_GroupGroups $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
-
-}
-
diff --git a/application/models/GroupMapper.php b/application/models/GroupMapper.php
deleted file mode 100644
index df93483..0000000
--- a/application/models/GroupMapper.php
+++ /dev/null
@@ -1,144 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_GroupMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Group($row);
- $entry->setID($row['groupID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Group');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Group $group)
- {
-
- $data = array('groupID'=> $group->getID() ,'title'=> $group->getTitle() ,'description'=> $group->getDescription() );
-
- if (null === ($id = $group->getID()) ) {
- unset($data['groupID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('groupID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Group $group)
- {
- if (null === ($id = $group->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('groupID = ?' => $id));
- }
- }
-
- public function find($id,Application_Model_Group $group = null)
- {
- $return = false;
- if($group == null){
- $return = true;
- }
- if($return){
- $group = new Application_Model_Group();
- }
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $group->setID($row->groupID)->setTitle($row->title)->setDescription($row->description);
- if($return){
- return $group;
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Group();
-
- $entry->setID($row->groupID)->setTitle($row->title)->setDescription($row->description);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Group $v1,Application_Model_Group $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
-}
-
diff --git a/application/models/PasswordRecoveryMapper.php b/application/models/PasswordRecoveryMapper.php
deleted file mode 100644
index c6ffd04..0000000
--- a/application/models/PasswordRecoveryMapper.php
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PasswordRecoveryMapper
-{
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
-
- $stmt = $select->query();
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_PasswordRecovery($row);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_PasswordRecovery');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_PasswordRecovery $passwordrecovery)
- {
-
- $data = array('personID'=> $passwordrecovery->getID() ,'recoveryID'=> $passwordrecovery->getRecoveryID() );
-
- if (null === ($id = $passwordrecovery->getID()) ) {
- return;
- } else {
- $passwordRecoveryFound = $this->find($passwordrecovery->getID());
- if(is_object($passwordRecoveryFound)) {
- $personIDFound = $passwordRecoveryFound->getID();
- }
- if(isset($personIDFound)) {
- $this->getDbTable()->update($data, array('personID = ?' => $passwordrecovery->getID()));
- } else {
- $this->getDbTable()->insert($data);
- }
- }
- }
-
- public function delete(Application_Model_PasswordRecovery $passwordrecovery)
- {
- if (null === ($id = $passwordrecovery->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('personID = ?' => $id));
- }
- }
-
- public function find($id)
- {
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $passwordrecovery = new Application_Model_PasswordRecovery();
- $passwordrecovery->setID($row->personID)->setRecoveryID($row->recoveryID);
- return $passwordrecovery;
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_PasswordRecovery();
-
- $entry->setID($row->personID)->setRecoveryID($row->recoveryID);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_PasswordRecovery $v1,Application_Model_PasswordRecovery $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-}
-
diff --git a/application/models/PersonMapper.php b/application/models/PersonMapper.php
deleted file mode 100644
index 9330e7e..0000000
--- a/application/models/PersonMapper.php
+++ /dev/null
@@ -1,198 +0,0 @@
-<?php
-/*
- * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
- * This program is free software distributed under the GPL version 2.
- * See http://gpl.openslx.org/
- *
- * If you have any feedback please consult http://feedback.openslx.org/ and
- * send your suggestions, praise, or complaints to feedback@openslx.org
- *
- * General information about OpenSLX can be found at http://openslx.org/
- */
-
-class Application_Model_PersonMapper
-{
-
- protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
- foreach($where as $k => $v){
- if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
- }
- $where = implode(" AND " ,$where2);
-
- try{
- $db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
- if(is_array($order)){
- foreach ($order as $k => $v)
- $a[] = "$k $v";
- $select->order($a);
- }
- # print_a($select);
- $stmt = $select->query();
- # print_a($stmt);
- $result = $stmt->fetchAll();
-
- if(!$array){
- $entries = array();
- foreach ($result as $row) {
- $entry = new Application_Model_Person($row);
- $entry->setID($row['personID']);
- $entries[] = $entry;
- }
- return $entries;
- }else{
- return $result;
- }
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
- }
- }
-
- public function setDbTable($dbTable)
- {
- if (is_string($dbTable)) {
- $dbTable = new $dbTable();
- }
-
- if (!$dbTable instanceof Zend_Db_Table_Abstract) {
- throw new Exception('Invalid table data gateway provided');
- }
-
- $this->_dbTable = $dbTable;
-
- return $this;
- }
-
- public function getDbTable()
- {
- if (null === $this->_dbTable) {
- $this->setDbTable('Application_Model_DbTable_Person');
- }
-
- return $this->_dbTable;
- }
-
- public function save(Application_Model_Person $person)
- {
-
- $data = array('personID'=> $person->getID() ,
- 'title'=> $person->getTitle() ,
- 'name'=> $person->getName() ,
- 'firstname'=> $person->getFirstname() ,
- 'street'=> $person->getStreet() ,
- 'housenumber'=> $person->getHousenumber() ,
- 'city'=> $person->getCity() ,
- 'postalcode'=> $person->getPostalcode() ,
- 'logindate'=> $person->getLogindate() ,
- 'registerdate'=> $person->getRegisterdate() ,
- 'email'=> $person->getEmail() ,
- 'login'=> $person->getLogin() ,
- 'password'=> $person->getPassword(),
- 'loginpassword'=> $person->getLoginpassword() ,
- 'password_salt'=> $person->getPasswordSalt() ,
- 'suspend'=> $person->getSuspend() );
-
- if (null === ($id = $person->getID()) ) {
- unset($data['personID']);
- $this->getDbTable()->insert($data);
- } else {
- $this->getDbTable()->update($data, array('personID = ?' => $id));
- }
- }
-
- public function delete(Application_Model_Person $person)
- {
- if (null === ($id = $person->getID()) ) {
- return;
- } else {
- $this->getDbTable()->delete(array('personID = ?' => $id));
- }
- }
-
- public function find($id,Application_Model_Person $person = null)
- {
- $return = false;
-
- if($person == null){
- $return = true;
- }
- if($return){
- $person = new Application_Model_Person();
- }
- $result = $this->getDbTable()->find($id);
- if (0 == count($result)) {
- return;
- }
-
- $row = $result->current();
-
- $person->setID($row->personID)
- ->setTitle($row->title)
- ->setName($row->name)
- ->setFirstname($row->firstname)
- ->setStreet($row->street)
- ->setHousenumber($row->housenumber)
- ->setCity($row->city)
- ->setPostalcode($row->postalcode)
- ->setLogindate($row->logindate)
- ->setRegisterdate($row->registerdate)
- ->setEmail($row->email)
- ->setLogin($row->login)
- ->setPassword($row->password)
- ->setPasswordSalt($row->password_salt)
- ->setLoginpassword($row->loginpassword)
- ->setSuspend($row->suspend);
- if($return){
- return $person;
- }
- }
-
- public function fetchAll()
- {
- $resultSet = $this->getDbTable()->fetchAll();
- $entries = array();
- foreach ($resultSet as $row) {
- $entry = new Application_Model_Person();
-
- $entry->setID($row->personID)
- ->setTitle($row->title)
- ->setName($row->name)
- ->setFirstname($row->firstname)
- ->setStreet($row->street)
- ->setHousenumber($row->housenumber)
- ->setCity($row->city)
- ->setPostalcode($row->postalcode)
- ->setLogindate($row->logindate)
- ->setRegisterdate($row->registerdate)
- ->setEmail($row->email)
- ->setLogin($row->login)
- ->setPassword($row->password)
- ->setPasswordSalt($row->password_salt)
- ->setSuspend($row->suspend)
- ->setLoginpassword($row->loginpassword);
-
- $entries[] = $entry;
- }
- return $entries;
- }
-
- public function compare(Application_Model_Person $v1,Application_Model_Person $v2){
- $vv1 = $v1->toArray();
- $vv2 = $v2->toArray();
- return array_diff($vv1,$vv2);
- }
-
-
-
-}
-
diff --git a/application/models/Right.php b/application/models/Right.php
new file mode 100644
index 0000000..7201dd7
--- /dev/null
+++ b/application/models/Right.php
@@ -0,0 +1,139 @@
+<?php
+/*
+ * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
+ * This program is free software distributed under the GPL version 2.
+ * See http://gpl.openslx.org/
+ *
+ * If you have any feedback please consult http://feedback.openslx.org/ and
+ * send your suggestions, praise, or complaints to feedback@openslx.org
+ *
+ * General information about OpenSLX can be found at http://openslx.org/
+ */
+
+class Application_Model_Right
+{
+ protected $_rightID;
+ protected $_rightcategoryID;
+ protected $_shortcut;
+ protected $_title;
+ protected $_description;
+
+ public function __construct(array $options = null)
+ {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
+
+ public function __set($name, $value)
+ {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid right property');
+ }
+ $this->$method($value);
+ }
+
+ public function __get($name)
+ {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid right property');
+ }
+ return $this->$method();
+ }
+
+ public function setOptions(array $options)
+ {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
+
+
+ public function getID()
+ {
+ return $this->_rightID;
+ }
+ public function setID($_rightID)
+ {
+ $this->_rightID = $_rightID;
+ return $this;
+ }
+ public function getRightcategoryID()
+ {
+ return $this->_rightcategoryID;
+ }
+ public function setRightcategoryID($_rightcategoryID)
+ {
+ $this->_rightcategoryID = $_rightcategoryID;
+ return $this;
+ }
+ public function getShortcut()
+ {
+ return $this->_shortcut;
+ }
+ public function setShortcut($_shortcut)
+ {
+ $this->_shortcut = $_shortcut;
+ return $this;
+ }
+ public function getTitle()
+ {
+ return $this->_title;
+ }
+ public function setTitle($_title)
+ {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription()
+ {
+ return $this->_description;
+ }
+ public function setDescription($_description)
+ {
+ $this->_description = $_description;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray()
+ {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key !== null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ }else{
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
+}
+
diff --git a/application/models/PasswordRecovery.php b/application/models/RightCategory.php
index f860cdd..fb6df23 100644
--- a/application/models/PasswordRecovery.php
+++ b/application/models/RightCategory.php
@@ -10,10 +10,10 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Application_Model_PasswordRecovery
+class Application_Model_RightCategory
{
- protected $_personID;
- protected $_recoveryID;
+ protected $_rightcategoryID;
+ protected $_title;
public function __construct(array $options = null)
{
@@ -26,7 +26,7 @@ class Application_Model_PasswordRecovery
{
$method = 'set' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid passwordrecovery property');
+ throw new Exception('Invalid rightcategory property');
}
$this->$method($value);
}
@@ -35,7 +35,7 @@ class Application_Model_PasswordRecovery
{
$method = 'get' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid membership property');
+ throw new Exception('Invalid rightcategory property');
}
return $this->$method();
}
@@ -51,31 +51,26 @@ class Application_Model_PasswordRecovery
}
return $this;
}
+
public function getID()
{
- return $this->_personID;
+ return $this->_rightcategoryID;
}
- public function setID($_personID)
+ public function setID($_rightcategoryID)
{
- $this->_personID = $_personID;
+ $this->_rightcategoryID = $_rightcategoryID;
return $this;
}
-
- public function getRecoveryID()
+ public function getTitle()
{
- return $this->_recoveryID;
+ return $this->_title;
}
- public function setRecoveryID($_recoveryID)
+ public function setTitle($_title)
{
- $this->_recoveryID = $_recoveryID;
+ $this->_title = $_title;
return $this;
}
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
- * If "get"-method not available (our primary keys) the function getID() is called
- */
+
public function toArray()
{
$reflectionClass = new ReflectionClass($this);
@@ -105,4 +100,5 @@ class Application_Model_PasswordRecovery
return $result;
}
-} \ No newline at end of file
+}
+
diff --git a/application/models/GroupGroups.php b/application/models/RightRoles.php
index 43dcab1..3b5f816 100644
--- a/application/models/GroupGroups.php
+++ b/application/models/RightRoles.php
@@ -10,10 +10,10 @@
* General information about OpenSLX can be found at http://openslx.org/
*/
-class Application_Model_GroupGroups
+class Application_Model_RightRoles
{
- protected $_parentID;
- protected $_groupID;
+ protected $_roleID;
+ protected $_rightID;
public function __construct(array $options = null)
{
@@ -26,7 +26,7 @@ class Application_Model_GroupGroups
{
$method = 'set' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid groupGroups property');
+ throw new Exception('Invalid rightroles property');
}
$this->$method($value);
}
@@ -35,7 +35,7 @@ class Application_Model_GroupGroups
{
$method = 'get' . $name;
if (('mapper' == $name) || !method_exists($this, $method)) {
- throw new Exception('Invalid groupGroups property');
+ throw new Exception('Invalid rightroles property');
}
return $this->$method();
}
@@ -53,22 +53,22 @@ class Application_Model_GroupGroups
}
- public function getParentID()
+ public function getRoleID()
{
- return $this->_parentID;
+ return $this->_roleID;
}
- public function setParentID($_parentID)
+ public function setRoleID($_roleID)
{
- $this->_parentID = $_parentID;
+ $this->_roleID = $_roleID;
return $this;
}
- public function getGroupID()
+ public function getRightID()
{
- return $this->_groupID;
+ return $this->_rightID;
}
- public function setGroupID($_groupID)
+ public function setRightID($_rightID)
{
- $this->_groupID = $_groupID;
+ $this->_rightID = $_rightID;
return $this;
}
/**
diff --git a/application/models/Role.php b/application/models/Role.php
new file mode 100644
index 0000000..3d03d53
--- /dev/null
+++ b/application/models/Role.php
@@ -0,0 +1,139 @@
+<?php
+/*
+ * Copyright (c) 2011 - OpenSLX GmbH, RZ Uni Freiburg
+ * This program is free software distributed under the GPL version 2.
+ * See http://gpl.openslx.org/
+ *
+ * If you have any feedback please consult http://feedback.openslx.org/ and
+ * send your suggestions, praise, or complaints to feedback@openslx.org
+ *
+ * General information about OpenSLX can be found at http://openslx.org/
+ */
+
+class Application_Model_Role
+{
+ protected $_roleID;
+ protected $_groupID;
+ protected $_title;
+ protected $_description;
+ protected $_inheritance;
+
+ public function __construct(array $options = null)
+ {
+ if (is_array($options)) {
+ $this->setOptions($options);
+ }
+ }
+
+ public function __set($name, $value)
+ {
+ $method = 'set' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid role property');
+ }
+ $this->$method($value);
+ }
+
+ public function __get($name)
+ {
+ $method = 'get' . $name;
+ if (('mapper' == $name) || !method_exists($this, $method)) {
+ throw new Exception('Invalid role property');
+ }
+ return $this->$method();
+ }
+
+ public function setOptions(array $options)
+ {
+ $methods = get_class_methods($this);
+ foreach ($options as $key => $value) {
+ $method = 'set' . ucfirst($key);
+ if (in_array($method, $methods)) {
+ $this->$method($value);
+ }
+ }
+ return $this;
+ }
+
+
+ public function getID()
+ {
+ return $this->_roleID;
+ }
+ public function setID($_roleID)
+ {
+ $this->_roleID = $_roleID;
+ return $this;
+ }
+ public function getGroupID()
+ {
+ return $this->_groupID;
+ }
+ public function setGroupID($_groupID)
+ {
+ $this->_groupID = $_groupID;
+ return $this;
+ }
+ public function getTitle()
+ {
+ return $this->_title;
+ }
+ public function setTitle($_title)
+ {
+ $this->_title = $_title;
+ return $this;
+ }
+ public function getDescription()
+ {
+ return $this->_description;
+ }
+ public function setDescription($_description)
+ {
+ $this->_description = $_description;
+ return $this;
+ }
+ public function getInheritance()
+ {
+ return $this->_inheritance;
+ }
+ public function setInheritance($_inheritance)
+ {
+ $this->_inheritance = $_inheritance;
+ return $this;
+ }
+ /**
+ * Returns current data as associative array using ReflectionClass
+ *
+ * @return array Returns associative array containing model data
+ * If "get"-method not available (our primary keys) the function getID() is called
+ */
+ public function toArray()
+ {
+ $reflectionClass = new ReflectionClass($this);
+ $properties = $reflectionClass->getProperties();
+ $result = array();
+ foreach ($properties as $property) {
+ $key = $property->name;
+ if (substr($key, 0, 1) != '_' && $this->$key !== null) {
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ } else {
+ $result[$key] = $this->$key;
+ }
+ }
+ elseif(substr($key, 0, 1) == '_' && $this->$key !== null) {
+ $key = substr($key, 1);
+ $method = 'get' . ucfirst($key);
+ if ($reflectionClass->hasMethod($method)) {
+ $result[$key] = $this->$method();
+ }else{
+ $result[$key] = $this->getID();
+ }
+
+ }
+ }
+ return $result;
+ }
+}
+
diff --git a/application/views/scripts/auth/login.phtml b/application/views/scripts/auth/login.phtml
index f172fe4..693f8ef 100644
--- a/application/views/scripts/auth/login.phtml
+++ b/application/views/scripts/auth/login.phtml
@@ -3,5 +3,4 @@
$this->loginForm->setAction($this->url());
echo $this->notification;
echo $this->loginForm;
-?>
-<div><button onclick="location.href='/auth/recoverpassword'">Recover Password</button></div> \ No newline at end of file
+?> \ No newline at end of file
diff --git a/application/views/scripts/auth/recoverpassword.phtml b/application/views/scripts/auth/recoverpassword.phtml
deleted file mode 100644
index 089aec3..0000000
--- a/application/views/scripts/auth/recoverpassword.phtml
+++ /dev/null
@@ -1,5 +0,0 @@
-<h1>Recover Password</h1>
-<?php
-$this->recoverPasswordForm->setAction($this->url());
-echo $this->recoverPasswordForm;
-?>
diff --git a/setup/poolctrl.sql b/setup/poolctrl.sql
index a2dfeef..2f987f3 100644
--- a/setup/poolctrl.sql
+++ b/setup/poolctrl.sql
@@ -29,7 +29,6 @@ CREATE TABLE IF NOT EXISTS `poolctrl_eventaction` (
PRIMARY KEY (`eventactionID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-
CREATE TABLE IF NOT EXISTS `poolctrl_eventreport` (
`reportID` int(11) NOT NULL AUTO_INCREMENT,
`report` varchar(140) COLLATE utf8_unicode_ci DEFAULT 'success',
@@ -59,7 +58,6 @@ CREATE TABLE IF NOT EXISTS `pbs_filter` (
`priority` int(11) NOT NULL,
PRIMARY KEY (`filterID`),
KEY `membershipID` (`membershipID`),
- KEY `groupID` (`groupID`),
KEY `bootmenuID` (`bootmenuID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -70,31 +68,9 @@ CREATE TABLE IF NOT EXISTS `pbs_bootmenu` (
`title` varchar(50) NOT NULL,
`created` varchar(14) NOT NULL,
`defaultbootmenu` tinyint(1) NOT NULL DEFAULT '0',
- PRIMARY KEY (`bootmenuID`),
- KEY `groupID` (`groupID`),
KEY `membershipID` (`membershipID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-CREATE TABLE IF NOT EXISTS `pbs_person` (
- `personID` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(30) COLLATE utf8_unicode_ci,
- `name` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
- `firstname` varchar(30) COLLATE utf8_unicode_ci NOT NULL,
- `street` varchar(30) COLLATE utf8_unicode_ci,
- `housenumber` varchar(30) COLLATE utf8_unicode_ci,
- `city` varchar(30) COLLATE utf8_unicode_ci,
- `postalcode` varchar(30) COLLATE utf8_unicode_ci,
- `logindate` varchar(14) COLLATE utf8_unicode_ci,
- `registerdate` varchar(14) COLLATE utf8_unicode_ci NOT NULL,
- `email` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
- `login` varchar(30) COLLATE utf8_unicode_ci,
- `password` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
- `password_salt` varchar(64) COLLATE utf8_unicode_ci NOT NULL,
- `loginpassword` varchar(512) COLLATE utf8_unicode_ci NOT NULL,
- `suspend` tinyint(1) NOT NULL,
- PRIMARY KEY (`personID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1;
-
CREATE TABLE IF NOT EXISTS `pbs_bootos` (
`bootosID` int(11) NOT NULL AUTO_INCREMENT,
`groupID` int(11) NOT NULL,
@@ -111,7 +87,6 @@ CREATE TABLE IF NOT EXISTS `pbs_bootos` (
`expires` VARCHAR(14),
`public` int(11) NOT NULL DEFAULT '-1',
PRIMARY KEY (`bootosID`),
- KEY `groupID` (`groupID`),
KEY `membershipID` (`membershipID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -125,35 +100,18 @@ CREATE TABLE IF NOT EXISTS `pbs_config` (
`created` VARCHAR(14) NOT NULL,
`bootosID` int(11) NOT NULL,
PRIMARY KEY (`configID`),
- KEY `groupID` (`groupID`),
KEY `membershipID` (`membershipID`),
KEY `bootosID` (`bootosID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-CREATE TABLE IF NOT EXISTS `pbs_group` (
- `groupID` int(11) NOT NULL AUTO_INCREMENT,
- `title` varchar(30) COLLATE utf8_unicode_ci NOT NULL UNIQUE,
- `description` varchar(140) COLLATE utf8_unicode_ci,
- PRIMARY KEY (`groupID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-
-CREATE TABLE IF NOT EXISTS `pbs_groupgroups` (
- `parentID` int(11) NOT NULL,
- `groupID` int(11) NOT NULL,
- PRIMARY KEY (`parentID`,`groupID`),
- KEY `parentID` (`parentID`),
- KEY `groupID` (`groupID`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
-
CREATE TABLE IF NOT EXISTS `pbs_membership` (
`membershipID` int(11) NOT NULL AUTO_INCREMENT,
`groupID` int(11) NOT NULL,
`personID` int(11) NOT NULL,
+ `roleID` int(11) NOT NULL,
`suspend` tinyint(1) NOT NULL,
`apikey` varchar(30),
PRIMARY KEY (`membershipID`),
- KEY `groupID` (`groupID`),
- KEY `personID` (`personID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
CREATE TABLE IF NOT EXISTS `pbs_pool` (
@@ -173,7 +131,6 @@ 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 (`groupID` ,`macadress`);
CREATE TABLE IF NOT EXISTS `pbs_poolentries` (
`poolentriesID` INT NOT NULL AUTO_INCREMENT,
@@ -191,7 +148,6 @@ CREATE TABLE IF NOT EXISTS `pbs_passwordrecovery` (
-- Constraints
ALTER TABLE `pbs_filter`
ADD CONSTRAINT `pbs_filter_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`),
- ADD CONSTRAINT `pbs_filter_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE,
ADD CONSTRAINT `pbs_filter_ibfk_3` FOREIGN KEY (`bootmenuID`) REFERENCES `pbs_bootmenu` (`bootmenuID`) ON DELETE CASCADE;
ALTER TABLE `pbs_bootmenu` ADD `startcounter` INT NOT NULL AFTER `title`;
@@ -199,33 +155,16 @@ ALTER TABLE `pbs_bootmenu` CHANGE `startcounter` `startcounter` INT( 11 ) NOT NU
ALTER TABLE `pbs_config`
ADD CONSTRAINT `pbs_config_ibfk_1` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE CASCADE,
- ADD CONSTRAINT `pbs_config_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE,
ADD CONSTRAINT `pbs_config_ibfk_3` FOREIGN KEY (`bootosID`) REFERENCES `pbs_bootos` (`bootosID`) ON DELETE CASCADE;
-ALTER TABLE `pbs_groupgroups`
- ADD CONSTRAINT `pbs_groupgroups_ibfk_1` FOREIGN KEY (`parentID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE,
- ADD CONSTRAINT `pbs_groupgroups_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE;
-
-ALTER TABLE `pbs_membership`
- ADD CONSTRAINT `pbs_membership_ibfk_1` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE,
- ADD CONSTRAINT `pbs_membership_ibfk_2` FOREIGN KEY (`personID`) REFERENCES `pbs_person` (`personID`) ON DELETE CASCADE;
-
ALTER TABLE `pbs_bootos`
- ADD CONSTRAINT `pbs_bootos_ibfk_2` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE,
ADD CONSTRAINT `pbs_bootos_ibfk_3` FOREIGN KEY (`membershipID`) REFERENCES `pbs_membership` (`membershipID`) ON DELETE SET NULL;
ALTER TABLE `pbs_client`
- ADD CONSTRAINT `pbs_client_ibfk_1` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE;
-
-ALTER TABLE `pbs_pool`
- ADD CONSTRAINT `pbs_pool_ibfk_1` FOREIGN KEY (`groupID`) REFERENCES `pbs_group` (`groupID`) ON DELETE CASCADE;
ALTER TABLE `pbs_poolentries`
ADD CONSTRAINT `pbs_poolentries_ibfk_1` FOREIGN KEY (`poolID`) REFERENCES `pbs_pool` (`poolID`) ON DELETE CASCADE;
-ALTER TABLE `pbs_passwordrecovery`
- ADD CONSTRAINT `pbs_passwordrecovery_ibfk_1` FOREIGN KEY (`personID`) REFERENCES `pbs_person` (`personID`) ON DELETE CASCADE;
-
ALTER TABLE `poolctrl_eventreport`
ADD CONSTRAINT `pbs_eventreport_eventidC` FOREIGN KEY (`eventID`) REFERENCES `poolctrl_event` (`eventID`) ON DELETE CASCADE;
diff --git a/setup/poolctrl_data.sql b/setup/poolctrl_data.sql
index c802a56..faf4fbd 100644
--- a/setup/poolctrl_data.sql
+++ b/setup/poolctrl_data.sql
@@ -1,48 +1,15 @@
USE ##poolctrl##;
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--- Adding person test
-INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`, `loginpassword`) VALUES
-(1, 'Herr', 'Super', 'Admin', 'Street', '1337', 'Teshouse', '1337', NULL, '1299612370', 'test', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a', '$6$Do9tGnw0$9ndoxsmcpNV.9mFTBRB7u2RbWekbSfjnUfPKXrCUEpXrZXoqnOesXITGl.RDy0cuaYB1Ouob6WtNWQqU/M/4U.');
-
--- Adding person test2
-INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`, `loginpassword`) VALUES
-(2, 'Herr', 'Test 2', 'Test 2', 'Teststr,', '5', 'Testburg', '1337', NULL, '1299612370', 'test2', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a', '$6$Do9tGnw0$9ndoxsmcpNV.9mFTBRB7u2RbWekbSfjnUfPKXrCUEpXrZXoqnOesXITGl.RDy0cuaYB1Ouob6WtNWQqU/M/4U.');
-
--- Adding person test3
-INSERT INTO `pbs_person` (`personID`, `title`, `name`, `firstname`, `street`, `housenumber`, `city`, `postalcode`, `logindate`, `registerdate`, `email`, `login`, `password`, `password_salt`, `loginpassword`) VALUES
-(3, 'Herr', 'Test 3', 'Test 3', 'Teststr,', '5', 'Testburg', '1337', NULL, '1299612370', 'test3', NULL, '4207acba08cadccc397e2302a55b339a', 'f21ee663b17bcefc6868694dffda602a', '$6$Do9tGnw0$9ndoxsmcpNV.9mFTBRB7u2RbWekbSfjnUfPKXrCUEpXrZXoqnOesXITGl.RDy0cuaYB1Ouob6WtNWQqU/M/4U.');
-
--- Adding group
-INSERT INTO `pbs_group` (`groupID` ,`title` ,`description`)VALUES
-(1, 'OpenSLX', 'This is the OpenSLX-Group'),
-(2, 'Germany', 'Deutschland'),
-(3, 'France', 'France'),
-(4, 'DFN', 'Deutsches Forschungsnetz'),
-(5, 'Institutionen', 'Fifth Group'),
-(6, 'Baden-Würtemberg', 'Sixth Group'),
-(7, 'Bayern', 'Seventh Group'),
-(8, 'Uni-Freiburg', 'Eight Group');
-
--- Adding groupgroups
-INSERT INTO `pbs_groupgroups` (`parentID`, `groupID`) VALUES
-(1, 2),
-(1, 3),
-(2, 4),
-(2, 5),
-(5, 6),
-(5, 7),
-(6, 8);
-
-- Adding memberships
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '1', '1', 'apikey1');
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '2', '1', 'apikey2');
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '3', '1', 'apikey3');
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '4', '1', 'apikey4');
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '5', '1', 'apikey4');
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '6', '1', 'apikey4');
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '7', '1', 'apikey4');
-INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `apikey`) VALUES (NULL, '8', '1', 'apikey4');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '1', '1', '1', 'apikey1');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '2', '1', '1', 'apikey2');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '3', '1', '1', 'apikey3');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '4', '1', '1', 'apikey4');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '5', '1', '1', 'apikey4');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '6', '1', '1', 'apikey4');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '7', '1', '1', 'apikey4');
+INSERT INTO `pbs_membership` (`membershipID`, `groupID`, `personID`, `roleID`, `apikey`) VALUES (NULL, '8', '1', '1', 'apikey4');
-- Adding clients
INSERT INTO `pbs_client` (`clientID`, `groupID`,`macadress`, `hardwarehash`) VALUES
@@ -117,8 +84,8 @@ INSERT INTO `pbs_filter` (`filterID`, `membershipID`, `groupID`, `bootmenuID`, `
INSERT INTO `poolctrl_eventcategory` (`eventcategoryID`, `title`) VALUES
(1, 'Lecture'),
(2, 'Maintenance'),
-(3, 'Private'),
-(4, 'Public');
+(3, 'Boot'),
+(4, 'Shutdown');
-- Adding eventactions
INSERT INTO `poolctrl_eventaction` (`eventactionID`, `title`) VALUES