summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon2011-04-13 16:09:18 +0200
committerSimon2011-04-13 16:09:18 +0200
commitee066778597d6361ba8ab9e1b1ba31b47492eb31 (patch)
tree4ff4146c4bc3ff502e755ae6a56e262fc3b8a1d5
parentneue Rechte hinzugefügt & Teil 3 (diff)
parentGültigkeit einer E-Mail Adresseüberprüfen (diff)
downloadpbs2-ee066778597d6361ba8ab9e1b1ba31b47492eb31.tar.gz
pbs2-ee066778597d6361ba8ab9e1b1ba31b47492eb31.tar.xz
pbs2-ee066778597d6361ba8ab9e1b1ba31b47492eb31.zip
merge
-rw-r--r--.zfproject.xml4
-rw-r--r--application/controllers/ResourceController.php39
-rw-r--r--application/models/Membership.php60
-rw-r--r--application/models/MembershipMapper.php62
-rw-r--r--application/models/Person.php60
-rw-r--r--application/models/PersonMapper.php6
-rw-r--r--application/modules/fbgui/views/scripts/index/start.phtml2
-rw-r--r--application/modules/user/controllers/AuthController.php12
-rw-r--r--application/modules/user/controllers/ConfigController.php4
-rw-r--r--application/modules/user/controllers/GroupController.php141
-rw-r--r--application/modules/user/controllers/PersonController.php49
-rw-r--r--application/modules/user/forms/PersonEdit.php4
-rw-r--r--application/modules/user/forms/Register.php78
-rw-r--r--application/modules/user/views/scripts/group/show.phtml233
-rw-r--r--application/modules/user/views/scripts/person/index.phtml39
-rw-r--r--application/modules/user/views/scripts/person/owndetails.phtml46
-rw-r--r--application/modules/user/views/scripts/person/show.phtml29
-rw-r--r--pbs.sql2
-rw-r--r--public/media/img/resume.pngbin0 -> 355 bytes
-rw-r--r--public/media/img/suspend.pngbin0 -> 335 bytes
20 files changed, 570 insertions, 300 deletions
diff --git a/.zfproject.xml b/.zfproject.xml
index b90455d..a81689c 100644
--- a/.zfproject.xml
+++ b/.zfproject.xml
@@ -126,6 +126,7 @@
<actionMethod actionName="owndetails"/>
<actionMethod actionName="show"/>
<actionMethod actionName="deleterequest"/>
+ <actionMethod actionName="suspend"/>
</controllerFile>
<controllerFile controllerName="Group">
<actionMethod actionName="index"/>
@@ -136,6 +137,9 @@
<actionMethod actionName="delete"/>
<actionMethod actionName="grantperson"/>
<actionMethod actionName="revokeperson"/>
+ <actionMethod actionName="decline"/>
+ <actionMethod actionName="suspendmembership"/>
+ <actionMethod actionName="resumemembership"/>
</controllerFile>
<controllerFile controllerName="Role">
<actionMethod actionName="index"/>
diff --git a/application/controllers/ResourceController.php b/application/controllers/ResourceController.php
index c172bf5..1c9425b 100644
--- a/application/controllers/ResourceController.php
+++ b/application/controllers/ResourceController.php
@@ -31,7 +31,7 @@ class ResourceController extends Zend_Controller_Action
$bootmenuentry = new Application_Model_BootMenuEntries();
$bootmenuentryMapper = new Application_Model_BootMenuEntriesMapper();
-
+ $bootosMapper = new Application_Model_BootOsMapper();
$bootmenuentryMapper->find($bootmenuentryID, $bootmenuentry);
$n = new Pbs_Session();
@@ -39,6 +39,7 @@ class ResourceController extends Zend_Controller_Action
$session->setBootosID($bootmenuentry->getBootosID())
->setBootmenuentryID($bootmenuentry->getID())
->setTime(time())
+ ->setMembershipID($bootosMapper->find($bootmenuentry->getBootmenuID())->getMembershipID())
->setIp($_SERVER['REMOTE_ADDR']);
$this->thisSession = $n->createSession($session);
@@ -82,10 +83,32 @@ class ResourceController extends Zend_Controller_Action
$bmm = new Application_Model_BootMenuEntriesMapper();
$bmm->find($bootmenuentryID,$bootmenuentry);
- $configID = $bootmenuentry->ge();
-
- if(is_dir("../resources/config/$configID/") && is_numeric($configID)){
-
+ $configID = $bootmenuentry->getConfigID();
+
+ $person = new Application_Model_Person();
+ $personMapper = new Application_Model_PersonMapper();
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $personID = $membershipMapper->find($this->thisSession->getMembershipID())->getPersonID();
+ $person = $personMapper->find($personID);
+ $loginname = strtolower($person->getName());
+ $loginname = preg_replace("!\s!","",$loginname);
+
+
+ if(is_dir("../resources/config/$configID/")){
+
+ $path_userconf = "../resources/config/$configID/".$this->thisSession->getMembershipID()."/";
+
+ if(!is_dir($path_userconf)){
+ mkdir($path_userconf ,0777, true);
+ exec("tar -C $path_userconf -xvf ../resources/config/$configID/default.tgz");
+ exec("cp ../resources/config/loginfiles/* $path_userconf/rootfs/etc/");
+ exec("tar -C $path_userconf -xvf ../resources/config/$configID/default.tgz");
+ exec("echo '$loginname:x:1000:1000:".$person->getName()." ".$person->getFirstname().",,,:/home/$loginname:/bin/bash' >> $path_userconf/rootfs/etc/passwd");
+ exec("md5pass ".$person->getPassword(), $pwhash);
+ exec("echo '$loginname:$pwhash[0]:0:0:99999:7:::' >> $path_userconf/rootfs/etc/shadow");
+ exec("echo 'mkdir /home/$loginname' >> $path_userconf/initramfs/postinit.local");
+ }
+
header('Content-Type: application/x-gzip');
$content_disp = ( ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT']) == 'IE') ? 'inline' : 'attachment';
header('Content-Disposition: ' . $content_disp . '; filename="default.tgz"');
@@ -93,7 +116,7 @@ class ResourceController extends Zend_Controller_Action
header('Expires: 0');
// create the gzipped tarfile.
- chdir("../resources/config/$configID/");
+ chdir($path_userconf);
passthru( "tar cz *");
}
}
@@ -164,7 +187,7 @@ class ResourceController extends Zend_Controller_Action
'kernel' => $this->generateURL('getkernel', 'alpha', $this->thisSession->getAlphasessionID(), "kernel"),
'initramfs' => $this->generateURL('getinitramfs', 'alpha', $this->thisSession->getAlphasessionID(), "initramfs"),
'kcl' => $this->generateURL('getkcl', 'alpha', $this->thisSession->getAlphasessionID(), "kcl.txt"),
- 'config' => $this->thisSession->getAlphasessionID()
+ 'config' => $this->generateURL('getconfig', 'alpha', $this->thisSession->getAlphasessionID(), 'default.tgz')
);
$result = $return_val;
@@ -173,7 +196,7 @@ class ResourceController extends Zend_Controller_Action
$result2 .= "<tr><td><b>kernel</b>: </td><td><a href=".$result['kernel'].">".$result['kernel']."<a></td></tr>";
$result2 .= "<tr><td><b>initramfs</b>: </td><td><a href=".$result['initramfs'].">".$result['initramfs']."<a></td></tr>";
$result2 .= "<tr><td><b>kcl</b>: </td><td><a href=".$result['kcl'].">".$result['kcl']."<a></td></tr>";
- $result2 .= "<tr><td><b>config</b>: </td><td>".$result['config']."</td></tr>";
+ $result2 .= "<tr><td><b>config</b>: </td><td><a href=".$result['config'].">".$result['config']."<a></td></tr>";
$result2 .= "</table>";
echo $result2;
}
diff --git a/application/models/Membership.php b/application/models/Membership.php
index eaa1f97..8a18d11 100644
--- a/application/models/Membership.php
+++ b/application/models/Membership.php
@@ -6,6 +6,7 @@ class Application_Model_Membership
protected $_groupID;
protected $_roleID;
protected $_personID;
+ protected $_suspended;
public function __construct(array $options = null)
{
@@ -81,39 +82,48 @@ class Application_Model_Membership
$this->_personID = $_personID;
return $this;
}
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
+ public function getSuspended()
+ {
+ return $this->_suspended;
+ }
+ public function setSuspended($_suspended)
+ {
+ $this->_suspended = $_suspended;
+ 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;
- }
- }
+ */
+ 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);
+ $method = 'get' . ucfirst($key);
if ($reflectionClass->hasMethod($method)) {
$result[$key] = $this->$method();
}else{
$result[$key] = $this->getID();
}
-
+
}
- }
- return $result;
- }
+ }
+ return $result;
+ }
}
diff --git a/application/models/MembershipMapper.php b/application/models/MembershipMapper.php
index 94f5236..68d6db8 100644
--- a/application/models/MembershipMapper.php
+++ b/application/models/MembershipMapper.php
@@ -2,34 +2,34 @@
class Application_Model_MembershipMapper
{
-
+
protected $_dbTable;
-
- public function findBy($where, $array=false, $order=false)
- {
+
+ public function findBy($where, $array=false, $order=false)
+ {
foreach($where as $k => $v){
if($v != null)
- $where2[] = "$k = '$v'";
- else
- $where2[] = "$k IS NULL";
+ $where2[] = "$k = '$v'";
+ else
+ $where2[] = "$k IS NULL";
}
$where = implode(" AND " ,$where2);
-
- try{
+
+ try{
$db = Zend_Db_Table::getDefaultAdapter();
- $select = $this->getDbTable()->select()
- ->from($this->_dbTable)
- ->where($where);
-
+ $select = $this->getDbTable()->select()
+ ->from($this->_dbTable)
+ ->where($where);
+
if(is_array($order)){
foreach ($order as $k => $v)
- $a[] = "$k $v";
+ $a[] = "$k $v";
$select->order($a);
}
-
+
$stmt = $select->query();
$result = $stmt->fetchAll();
-
+
if(!$array){
$entries = array();
foreach ($result as $row) {
@@ -41,11 +41,11 @@ class Application_Model_MembershipMapper
}else{
return $result;
}
-
- }catch (Zend_Exception $e) {
- echo "Error message 2: " . $e->getMessage() . "\n";
+
+ }catch (Zend_Exception $e) {
+ echo "Error message 2: " . $e->getMessage() . "\n";
}
- }
+ }
public function setDbTable($dbTable)
{
@@ -58,7 +58,7 @@ class Application_Model_MembershipMapper
}
$this->_dbTable = $dbTable;
-
+
return $this;
}
@@ -67,14 +67,14 @@ class Application_Model_MembershipMapper
if (null === $this->_dbTable) {
$this->setDbTable('Application_Model_DbTable_Membership');
}
-
+
return $this->_dbTable;
}
public function save(Application_Model_Membership $membership)
{
-
- $data = array('membershipID'=> $membership->getID() ,'groupID'=> $membership->getGroupID() ,'roleID'=> $membership->getRoleID() ,'personID'=> $membership->getPersonID() );
+
+ $data = array('membershipID'=> $membership->getID() ,'groupID'=> $membership->getGroupID() ,'roleID'=> $membership->getRoleID() ,'personID'=> $membership->getPersonID() ,'suspended'=> $membership->getSuspended() );
if (null === ($id = $membership->getID()) ) {
unset($data['membershipID']);
@@ -83,7 +83,7 @@ class Application_Model_MembershipMapper
$this->getDbTable()->update($data, array('membershipID = ?' => $id));
}
}
-
+
public function delete(Application_Model_Membership $membership)
{
if (null === ($id = $membership->getID()) ) {
@@ -108,8 +108,8 @@ class Application_Model_MembershipMapper
}
$row = $result->current();
-
- $membership->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID);
+
+ $membership->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID)->setSuspended($row->suspended);
if($return){
return $membership;
}
@@ -121,14 +121,14 @@ class Application_Model_MembershipMapper
$entries = array();
foreach ($resultSet as $row) {
$entry = new Application_Model_Membership();
-
- $entry->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID);
+
+ $entry->setID($row->membershipID)->setGroupID($row->groupID)->setRoleID($row->roleID)->setPersonID($row->personID)->setSuspended($row->suspended);
$entries[] = $entry;
}
return $entries;
}
-
+
public function compare(Application_Model_Membership $v1,Application_Model_Membership $v2){
$vv1 = $v1->toArray();
$vv2 = $v2->toArray();
@@ -136,6 +136,6 @@ class Application_Model_MembershipMapper
}
-
+
}
diff --git a/application/models/Person.php b/application/models/Person.php
index aea348d..6a591cf 100644
--- a/application/models/Person.php
+++ b/application/models/Person.php
@@ -16,6 +16,7 @@ class Application_Model_Person
protected $_login;
protected $_password;
protected $_password_salt;
+ protected $_suspended;
public function __construct(array $options = null)
{
@@ -183,39 +184,48 @@ class Application_Model_Person
{
return $this->_password_salt;
}
- /**
- * Returns current data as associative array using ReflectionClass
- *
- * @return array Returns associative array containing model data
+ public function getSuspended()
+ {
+ return $this->_suspended;
+ }
+ public function setSuspended($_suspended)
+ {
+ $this->_suspended = $_suspended;
+ 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;
- }
- }
+ */
+ 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);
+ $method = 'get' . ucfirst($key);
if ($reflectionClass->hasMethod($method)) {
$result[$key] = $this->$method();
}else{
$result[$key] = $this->getID();
}
-
+
}
- }
- return $result;
- }
+ }
+ return $result;
+ }
}
diff --git a/application/models/PersonMapper.php b/application/models/PersonMapper.php
index 537d862..4093c07 100644
--- a/application/models/PersonMapper.php
+++ b/application/models/PersonMapper.php
@@ -74,7 +74,7 @@ class Application_Model_PersonMapper
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() ,'password_salt'=> $person->getPasswordSalt() );
+ $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() ,'password_salt'=> $person->getPasswordSalt() ,'suspended'=> $person->getSuspended() );
if (null === ($id = $person->getID()) ) {
unset($data['personID']);
@@ -110,7 +110,7 @@ class Application_Model_PersonMapper
$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);
+ $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)->setSuspended($row->suspended);
if($return){
return $person;
}
@@ -123,7 +123,7 @@ class Application_Model_PersonMapper
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);
+ $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)->setSuspended($row->suspended);
$entries[] = $entry;
}
diff --git a/application/modules/fbgui/views/scripts/index/start.phtml b/application/modules/fbgui/views/scripts/index/start.phtml
index 94e8d97..2c29fa5 100644
--- a/application/modules/fbgui/views/scripts/index/start.phtml
+++ b/application/modules/fbgui/views/scripts/index/start.phtml
@@ -121,4 +121,4 @@ fbgui.startDownload('http://<?php echo $this->host; ?>/resource/getkcl/alpha/<?p
function foo(){
fbgui.quit();
}
-</script>";
+</script>
diff --git a/application/modules/user/controllers/AuthController.php b/application/modules/user/controllers/AuthController.php
index d1596ae..a90c8db 100644
--- a/application/modules/user/controllers/AuthController.php
+++ b/application/modules/user/controllers/AuthController.php
@@ -52,9 +52,14 @@ class User_AuthController extends Zend_Controller_Action
$person->setID($result[0]['personID']);
$date = new DateTime();
$person->setLogindate($date->getTimestamp());
- $this->personmapper->save($person);
- $this->_helper->redirector('selectmembership', 'person');
- return;
+ if($person->getSuspended()) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Your Account is suspended', 'error');
+ } else {
+ $this->personmapper->save($person);
+ $this->_helper->redirector('selectmembership', 'person');
+ return;
+ }
} else {
$pbsNotifier = new Pbs_Notifier();
$this->view->notification = $pbsNotifier->notify('Wrong Email or Password', 'error');
@@ -95,6 +100,7 @@ class User_AuthController extends Zend_Controller_Action
$person = new Application_Model_Person($_POST);
$this->personmapper = new Application_Model_PersonMapper();
$date = new DateTime();
+ $person->setSuspended(0);
$person->setRegisterdate($date->getTimestamp());
$person->setPasswordSalt(MD5($date->getTimestamp()));
$person->setPassword(MD5($person->getPassword() . $person->getPasswordSalt()));
diff --git a/application/modules/user/controllers/ConfigController.php b/application/modules/user/controllers/ConfigController.php
index a835b31..851ec9a 100644
--- a/application/modules/user/controllers/ConfigController.php
+++ b/application/modules/user/controllers/ConfigController.php
@@ -138,6 +138,10 @@ class user_ConfigController extends Zend_Controller_Action
$this->view->configForm = $configForm;
}
+ public function addUserAction(){
+
+ }
+
public function editconfigAction()
{
//ACL Darf er Configs editieren?
diff --git a/application/modules/user/controllers/GroupController.php b/application/modules/user/controllers/GroupController.php
index a2434d2..e36bba7 100644
--- a/application/modules/user/controllers/GroupController.php
+++ b/application/modules/user/controllers/GroupController.php
@@ -23,11 +23,11 @@ class User_GroupController extends Zend_Controller_Action
$this->personmapper = new Application_Model_PersonMapper();
$this->rolemapper = new Application_Model_RoleMapper();
$this->groupList = $this->groupMapper->fetchAll();
-
+
$userIDsNamespace = Zend_Session::namespaceGet('userIDs');
$this->membership = new Application_Model_Membership();
$this->membershipMapper->find($userIDsNamespace['membershipID'],$this->membership);
-
+
} else {
$this->_helper->redirector('login', 'auth');
return;
@@ -38,8 +38,8 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL show overview
if(!Pbs_Acl::checkRight('gso'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
$this->view->groupList = $this->groupList;
// Search
@@ -74,7 +74,7 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL create new group
if(!Pbs_Acl::checkRight('gc'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
if (!isset($_POST["add"])){
$addForm = new user_Form_GroupAdd(array('grouplist' => $this->groupList));
@@ -198,7 +198,7 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL create new group
if(!Pbs_Acl::checkRight('gsdo') && !Pbs_Acl::checkRight('gsdog'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$groupID = $this->_request->getParam('groupID');
if($groupID == '' || !Pbs_Acl::checkRight('gsdog')) {
@@ -207,30 +207,30 @@ class User_GroupController extends Zend_Controller_Action
}
}
if($groupID == $this->membership->getGroupID() && !Pbs_Acl::checkRight('gsdo'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
$this->view->usergroup = $this->membership->getGroupID();
$this->view->requestgroup = $groupID;
// ACL is he allowed to see the requests of a group ?
// TODO: THERE IS NO RIGHT TO EDIT A GROUP
- # if(Pbs_Acl::checkRight('')){
- $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true);
- if(isset($groupRequests)) {
- foreach($groupRequests as $groupRequest) {
- $person = $this->personmapper->find($groupRequest['personID']);
- $groupRequestList[] = array(
+ # if(Pbs_Acl::checkRight('')){
+ $groupRequests = $this->groupRequestMapper->findBy(array('groupID' => $groupID),true);
+ if(isset($groupRequests)) {
+ foreach($groupRequests as $groupRequest) {
+ $person = $this->personmapper->find($groupRequest['personID']);
+ $groupRequestList[] = array(
'grouprequestID' => $groupRequest['grouprequestID'],
'person' => $person
- );
- }
- if(is_array($groupRequestList)) {
- $this->view->groupRequestList = $groupRequestList;
- }
- // TODO: expand with al inherit roles
- $this->view->roleList = $this->rolemapper->findBy(array('groupID' => $groupID),true);
+ );
}
+ if(is_array($groupRequestList)) {
+ $this->view->groupRequestList = $groupRequestList;
+ }
+ // TODO: expand with al inherit roles
+ $this->view->roleList = $this->rolemapper->findBy(array('groupID' => $groupID),true);
+ }
# }
-
+
if(Pbs_Acl::checkRight('gsmg')){
$members = $this->membershipMapper->findBy(array('groupID' => $groupID),true);
if(isset($members)) {
@@ -240,6 +240,7 @@ class User_GroupController extends Zend_Controller_Action
$role = $this->rolemapper->find($membership_tmp->getRoleID());
$membersList[] = array(
'membershipID' => $member['membershipID'],
+ 'suspended' => $member['suspended'],
'person' => $person,
'role' => $role
);
@@ -303,8 +304,8 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL delete a group
if(!Pbs_Acl::checkRight('gd'))
- $this->_redirect('/user');
-
+ $this->_redirect('/user');
+
$this->_helper->viewRenderer->setNoRender();
$groupID = $this->_request->getParam('groupID');
if(!isset($groupID)) {
@@ -342,7 +343,7 @@ class User_GroupController extends Zend_Controller_Action
{
// ACL grant a membership to request
if(!Pbs_Acl::checkRight('gam'))
- $this->_redirect('/user');
+ $this->_redirect('/user');
$this->_helper->viewRenderer->setNoRender();
if(isset($_POST['grouprequestID']) && isset($_POST['roleID'])) {
@@ -378,11 +379,11 @@ class User_GroupController extends Zend_Controller_Action
public function revokepersonAction()
{
-
+
$this->_helper->viewRenderer->setNoRender();
$membershipID = $this->_request->getParam('membershipID');
$rr = $this->membershipMapper->find($membershipID);
-
+
if(($rr->getGroupID() == $this->membership->getGroupID && Pbs_Acl::checkRight('gdmo') ) || ( $rr->getGroupID() != $this->membership->getGroupID && Pbs_Acl::checkRight('gdmog'))){
if(isset($membershipID)) {
$membership = $this->membershipMapper->find($membershipID);
@@ -397,7 +398,91 @@ class User_GroupController extends Zend_Controller_Action
}
$this->_redirect("/user/group/show/groupID/" . $membership->getGroupID());
}
- }
+ }
+ }
+ }
+
+ public function declineAction()
+ {
+ if(!Pbs_Acl::checkRight('gdm')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $grouprequestID = $this->_request->getParam('grouprequestID');
+ if(isset($grouprequestID)) {
+ $groupRequest = $this->groupRequestMapper->find($grouprequestID);
+ if($groupRequest->getGroupID() != $this->userIDsNamespace['groupID']) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Not allowed to decline this grouprequest', 'forbidden');
+ return;
+ }
+ try {
+ $this->groupRequestMapper->delete($groupRequest);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/groupID");
+ }
+ }
+
+ public function suspendmembershipAction()
+ {
+ if(!Pbs_Acl::checkRight('gsm')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $membershipID = $this->_request->getParam('membershipID');
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ $membership->setSuspended(1);
+ if(isset($membership)) {
+ if($membership->getGroupID() != $this->userIDsNamespace['groupID']) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Not allowed to suspend this membership', 'forbidden');
+ return;
+ }
+ try {
+ $this->membershipMapper->save($membership);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/");
+ }
+ }
+ }
+
+ public function resumemembershipAction()
+ {
+ if(!Pbs_Acl::checkRight('gsm')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $membershipID = $this->_request->getParam('membershipID');
+ if(isset($membershipID)) {
+ $membership = $this->membershipMapper->find($membershipID);
+ $membership->setSuspended(0);
+ if(isset($membership)) {
+ if($membership->getGroupID() != $this->userIDsNamespace['groupID']) {
+ $pbsNotifier = new Pbs_Notifier();
+ $this->view->notification = $pbsNotifier->notify('Not allowed to resume this membership', 'forbidden');
+ return;
+ }
+ try {
+ $this->membershipMapper->save($membership);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/group/show/");
+ }
}
}
}
diff --git a/application/modules/user/controllers/PersonController.php b/application/modules/user/controllers/PersonController.php
index 98f7bb5..25b1f0a 100644
--- a/application/modules/user/controllers/PersonController.php
+++ b/application/modules/user/controllers/PersonController.php
@@ -63,6 +63,7 @@ class user_PersonController extends Zend_Controller_Action
$this->view->showOtherRight = Pbs_Acl::checkRight('psood');
$this->view->editOtherRight = Pbs_Acl::checkRight('peoa');
$this->view->deleteOtherRight = Pbs_Acl::checkRight('pdo');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
$this->view->userIDsNamespace = $this->userIDsNamespace;
$this->view->personList = $this->personmapper->fetchAll();
@@ -123,6 +124,7 @@ class user_PersonController extends Zend_Controller_Action
$this->view->groupRequestRight = true;
$this->view->editRight = Pbs_Acl::checkRight('peod');
$this->view->leaveRight = Pbs_Acl::checkRight('gl');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
$this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
}
@@ -386,6 +388,7 @@ class user_PersonController extends Zend_Controller_Action
$this->view->personID = $personID;
$this->view->editRight = Pbs_Acl::checkRight('peoa');
$this->view->deleteRight = Pbs_Acl::checkRight('pd');
+ $this->view->suspendRight = Pbs_Acl::checkRight('psa');
$this->view->userIDsNamespace = Zend_Session::namespaceGet('userIDs');
} else {
$this->_helper->redirector('', 'person');
@@ -409,6 +412,52 @@ class user_PersonController extends Zend_Controller_Action
return;
}
+ public function suspendAction()
+ {
+ if(!Pbs_Acl::checkRight('psa')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $personID = $this->_request->getParam('personID');
+ if(isset($personID)) {
+ $person = $this->personmapper->find($personID);
+ $person->setSuspended(1);
+ if(isset($person)) {
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/person/");
+ }
+ }
+ }
+ public function resumeAction()
+ {
+ if(!Pbs_Acl::checkRight('psa')) {
+ $this->_redirect('/user');
+ }
+ $this->_helper->viewRenderer->setNoRender();
+ $personID = $this->_request->getParam('personID');
+ if(isset($personID)) {
+ $person = $this->personmapper->find($personID);
+ $person->setSuspended(0);
+ if(isset($person)) {
+ try {
+ $this->personmapper->save($person);
+ } catch(Zend_Exception $e)
+ {
+ echo "Caught exception: " . get_class($e) . "<br/>";
+ echo "Message: " . $e->getMessage() . "<br/>";
+ return;
+ }
+ $this->_redirect("/user/person/");
+ }
+ }
+ }
}
diff --git a/application/modules/user/forms/PersonEdit.php b/application/modules/user/forms/PersonEdit.php
index 7175691..8db6c9e 100644
--- a/application/modules/user/forms/PersonEdit.php
+++ b/application/modules/user/forms/PersonEdit.php
@@ -82,7 +82,7 @@ class user_Form_PersonEdit extends Zend_Form
$this->addElement('text', 'email', array(
'filters' => array('StringTrim', 'StringToLower'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
+ array('StringLength', false, array(0, 50)),array('EmailAddress', "deep" => true, "mx" => true),
),
'required' => true,
'label' => 'Email:',
@@ -92,7 +92,7 @@ class user_Form_PersonEdit extends Zend_Form
$this->addElement('password', 'newpassword', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
+ array('StringLength', false, array(5, 50)),
),
'required' => false,
'label' => 'Neues Password:',
diff --git a/application/modules/user/forms/Register.php b/application/modules/user/forms/Register.php
index 9c2a42d..c0a4d9d 100644
--- a/application/modules/user/forms/Register.php
+++ b/application/modules/user/forms/Register.php
@@ -3,103 +3,103 @@
class user_Form_Register extends Zend_Form
{
- public function init()
- {
- $this->setName("Register");
+ public function init()
+ {
+ $this->setName("Register");
$this->setMethod('post');
- $this->addElement('text', 'title', array(
+ $this->addElement('text', 'title', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),
+ ),
'required' => true,
'label' => 'Title:',
));
-
-
+
+
$this->addElement('text', 'name', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),
+ ),
'required' => true,
'label' => 'Name:',
));
-
+
$this->addElement('text', 'firstname', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),
+ ),
'required' => true,
'label' => 'Firstname:',
));
-
+
$this->addElement('text', 'street', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),
+ ),
'required' => true,
'label' => 'Street:',
));
-
+
$this->addElement('text', 'housenumber', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),
+ ),
'required' => true,
'label' => 'Housenumber:',
));
-
+
$this->addElement('text', 'city', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),
+ ),
'required' => true,
'label' => 'City:',
));
-
+
$this->addElement('text', 'postalcode', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),
+ ),
'required' => true,
'label' => 'Postalcode:',
));
-
+
$this->addElement('text', 'email', array(
'filters' => array('StringTrim', 'StringToLower'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(0, 50)),array('EmailAddress', "deep" => true, "mx" => true),
+ ),
'required' => true,
'label' => 'Email:',
));
-
+
$this->addElement('password', 'password', array(
'filters' => array('StringTrim'),
'validators' => array(
- array('StringLength', false, array(0, 50)),
- ),
+ array('StringLength', false, array(5, 50)),
+ ),
'required' => true,
'label' => 'Password:',
- ));
-
- $this->addElement('submit', 'register', array(
+ ));
+
+ $this->addElement('submit', 'register', array(
'required' => false,
'ignore' => true,
'label' => 'Register',
- ));
-
-
- }
+ ));
+
+
+ }
+
-
}
diff --git a/application/modules/user/views/scripts/group/show.phtml b/application/modules/user/views/scripts/group/show.phtml
index b2a85ac..b01ade4 100644
--- a/application/modules/user/views/scripts/group/show.phtml
+++ b/application/modules/user/views/scripts/group/show.phtml
@@ -1,6 +1,6 @@
<h1>Groupdetails - <?php echo $this->group->getTitle();?></h1>
-<?php
-if($this->usergroup == $this->requestgroup){
+<?php
+if($this->usergroup == $this->requestgroup){
echo $this->formButton('deletegroup', 'Delete', array(
'onclick' => 'self.location="/user/group/delete/"',
'class' => 'rightbutton'));
@@ -18,111 +18,105 @@ else{
}
?>
<div class='listelement'>
- <div class='element'>
- <div class='number'>
- <?php
- if($this->usergroup == $this->requestgroup){ ?>
- <div class='smallnumber'>Your Group</div>
- <?php }else{ ?>
- <div class='smallnumber'>Group</div>
- <?php echo $this->group->getID(); ?>
- <?php } ?>
- </div>
- <div class='content'>
- <div class='title'><?php echo $this->group->getTitle(); ?></div>
- <div class='subtitle'><?php echo $this->group->getDescription(); ?></div>
- <?php if(isset($parentGroup) && is_object($parentGroup)): ?>
- <div class='details'>
- <label>Superordinated Group:</label><div class='item'><?php echo $this->parentGroup->getTitle(); ?></div>
- </div>
- <?php endif ;?>
- </div>
- <div class='clear'></div>
- </div>
+<div class='element'>
+<div class='number'><?php
+if($this->usergroup == $this->requestgroup){ ?>
+<div class='smallnumber'>Your Group</div>
+<?php }else{ ?>
+<div class='smallnumber'>Group</div>
+<?php echo $this->group->getID(); ?> <?php } ?></div>
+<div class='content'>
+<div class='title'><?php echo $this->group->getTitle(); ?></div>
+<div class='subtitle'><?php echo $this->group->getDescription(); ?></div>
+<?php if(isset($parentGroup) && is_object($parentGroup)): ?>
+<div class='details'><label>Superordinated Group:</label>
+<div class='item'><?php echo $this->parentGroup->getTitle(); ?></div>
+</div>
+<?php endif ;?></div>
+<div class='clear'></div>
+</div>
</div>
<?php
// Show Request List
if(isset($this->groupRequestList)){
-?>
+ ?>
<br />
<h2>Requests:</h2>
-<div class='listelement'>
- <?php
- foreach($this->groupRequestList as $grouprequest) {
+<div class='listelement'><?php
+foreach($this->groupRequestList as $grouprequest) {
$grouprequestID = $grouprequest['grouprequestID'];
$person = $grouprequest['person'];
?>
- <div class='element'>
- <div class='content'>
- <?php
- if($this->usergroup == $this->requestgroup && (Pbs_Acl::checkRight('gam') || Pbs_Acl::checkRight('gdm'))){
- ?>
- <div class='actions'>
- <?php if(Pbs_Acl::checkRight('gam')): ?>
- <form action="/user/group/grantperson" method="post">
- <input type="hidden" name="grouprequestID" value="<?php echo $grouprequestID; ?>" /> <?php printRoleSelect($this->roleList); ?>
- <input type="image" src='/media/img/save.png' alt='Grant Person' name="confirm" value="confirm" />
- </form>
- <?php endif; ?>
- <?php if(Pbs_Acl::checkRight('gdm')): ?>
- TODO
- <?php endif; ?>
- </div>
- <?php
- }
- ?>
- <div class='title'><?php echo $person->getTitle(); ?>&nbsp;<?php echo $person->getFirstname(); ?>&nbsp;<?php echo $person->getName(); ?></div>
- <div class='subtitle'><?php echo $person->getCity(); ?></div>
- <div class='details dispnone'>
- <label>Email</label>
- <div class='item'><?php echo $person->getEmail(); ?></div>
- </div>
- </div>
- </div>
- <?php
- }
+<div class='element'>
+<div class='content'><?php
+if($this->usergroup == $this->requestgroup && (Pbs_Acl::checkRight('gam') || Pbs_Acl::checkRight('gdm'))){
?>
+<div class='actions'><?php if(Pbs_Acl::checkRight('gam')): ?>
+<form action="/user/group/grantperson" method="post"><input
+ type="hidden" name="grouprequestID"
+ value="<?php echo $grouprequestID; ?>" /> <?php printRoleSelect($this->roleList); ?>
+<input type="image" src='/media/img/save.png' alt='Grant Person'
+ name="confirm" value="confirm" /> <?php endif; ?> <?php if(Pbs_Acl::checkRight('gdm')): ?>&nbsp;<a
+ href="<?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'group',
+ 'action' => 'decline',
+ 'grouprequestID' => $grouprequestID,
+ ),
+ 'default',
+ true) ?>"> <img src='/media/img/delete.png'
+ alt='Decline Membership' /></a> <?php endif; ?></form>
+</div>
+ <?php
+}
+?>
+
+<div class='title'><?php echo $person->getTitle(); ?>&nbsp;<?php echo $person->getFirstname(); ?>&nbsp;<?php echo $person->getName(); ?></div>
+<div class='subtitle'><?php echo $person->getCity(); ?></div>
+<div class='details dispnone'><label>Email</label>
+<div class='item'><?php echo $person->getEmail(); ?></div>
+</div>
</div>
+</div>
+<?php
+}
+?></div>
<?php
}
// Show Memberlist
if(isset($this->membersList) && Pbs_Acl::checkRight('gsmg')){
-?>
+ ?>
<br />
<h2>Members:</h2>
-<div class='listelement'>
-<?php
+<div class='listelement'><?php
if(count($this->membersList)==0)
- echo "This hroup has no members."
+echo "This hroup has no members."
+?> <?php foreach ($this->membersList as $k => $member): ?> <?php
+$membershipID = $member['membershipID'];
+$suspended = $member['suspended'];
+$person = $member['person'];
+$role = $member['role'];
+$class='';
+if($person->getID() == $this->userIDsNamespace['personID'])
+$class= 'highlight checked';
?>
-<?php foreach ($this->membersList as $k => $member): ?>
- <?php
- $membershipID = $member['membershipID'];
- $person = $member['person'];
- $role = $member['role'];
- $class='';
- if($person->getID() == $this->userIDsNamespace['personID'])
- $class= 'highlight checked';
+<div class='element<?php echo " $class";?>'><?php
+if($person->getID() != $this->userIDsNamespace['personID']) {
?>
- <div class='element<?php echo " $class";?>'>
- <?php
- if($person->getID() != $this->userIDsNamespace['personID']) {
- ?>
- <div class='number'>
- <div class='smallnumber'>Person</div>
- <?php echo $k+1; ?>
- </div>
- <?php
- }
- ?>
- <div class='content'>
- <div class='actions'>
- <?php
- if((Pbs_Acl::checkRight('gdmo') && $this->usergroup == $this->requestgroup) || (Pbs_Acl::checkRight('gdmog') && $this->usergroup != $this->requestgroup)):
- ?>
- <a href="<?php echo $this->url(
+<div class='number'>
+<div class='smallnumber'>Person</div>
+ <?php echo $k+1; ?></div>
+ <?php
+}
+?>
+<div class='content'>
+<div class='actions'><?php
+if((Pbs_Acl::checkRight('gdmo') && $this->usergroup == $this->requestgroup) || (Pbs_Acl::checkRight('gdmog') && $this->usergroup != $this->requestgroup)):
+?> <a
+ href="<?php echo $this->url(
array(
'module' => 'user',
'controller' => 'group',
@@ -130,26 +124,57 @@ if(count($this->membersList)==0)
'membershipID' => $membershipID,
),
'default',
- true) ?>"> <img src='/media/img/delete.png' alt='Revoke Membership' /></a>
- <?php
- endif;
- ?>
- </div>
- <div class='title'><?php echo $person->getFirstname(); ?> <?php echo $person->getName(); ?></div>
- <div class='subtitle'>Role: <?php echo $role->getTitle(); ?></div>
- <div class='details dispnone'>
- <label>Email</label>
- <div class='item'><?php echo $person->getEmail(); ?></div>
- <label>City</label>
- <div class='item'><?php echo $person->getCity(); ?></div>
- </div>
- </div>
- <div class='clear'></div>
- </div>
-<?php endforeach ?>
+ true) ?>"> <img src='/media/img/delete.png'
+ alt='Revoke Membership' /></a> <?php
+ endif;
+ if(Pbs_Acl::checkRight('gsm')) {
+ if($suspended == 1)
+ {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'group',
+ 'action' => 'resumemembership',
+ 'membershipID' => $membershipID
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/resume.png'
+ alt='Resume Membership' /></a> <?php
+ } else {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'group',
+ 'action' => 'suspendmembership',
+ 'membershipID' => $membershipID
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/suspend.png'
+ alt='Suspend Membership' /></a> <?php
+ }
+ }
+ ?></div>
+<div class='title'><?php echo $person->getFirstname(); ?> <?php echo $person->getName(); ?></div>
+<div class='subtitle'>Role: <?php echo $role->getTitle(); ?></div>
+<div class='details dispnone'><label>Email</label>
+<div class='item'><?php echo $person->getEmail(); ?></div>
+<label>City</label>
+<div class='item'><?php echo $person->getCity(); ?></div>
+ <?php
+ if(Pbs_Acl::checkRight('gsm')) {
+ ?> <label>Membership suspended</label>
+<div class='item'><?php if($suspended == 1) echo "yes"; else echo "no"; ?></div>
+ <?php
+ }
+ ?></div>
</div>
-<?php echo $this->memberPagination; ?>
-<?php
+<div class='clear'></div>
+</div>
+ <?php endforeach ?></div>
+ <?php echo $this->memberPagination; ?>
+ <?php
}
diff --git a/application/modules/user/views/scripts/person/index.phtml b/application/modules/user/views/scripts/person/index.phtml
index 1304299..93dfd78 100644
--- a/application/modules/user/views/scripts/person/index.phtml
+++ b/application/modules/user/views/scripts/person/index.phtml
@@ -15,14 +15,12 @@ $class='';
if($person->getID() == $this->userIDsNamespace['personID'])
$class= 'highlight checked';
?>
-<div class='element<?php echo " $class";?>'>
-<?php if($person->getID() != $this->userIDsNamespace['personID']) {
+<div class='element<?php echo " $class";?>'><?php if($person->getID() != $this->userIDsNamespace['personID']) {
?>
- <div class='number'>
- <div class='smallnumber'>Person</div>
- <?php echo $k+1; ?>
- </div>
-<?php
+<div class='number'>
+<div class='smallnumber'>Person</div>
+ <?php echo $k+1; ?></div>
+ <?php
}
?>
<div class='content'>
@@ -103,6 +101,33 @@ if($person->getID() == $this->userIDsNamespace['personID']) {
<?php
}
}
+if($this->suspendRight === true) {
+ if($person->getSuspended() == 1) {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'resume',
+ 'personID' => $person->getID()
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/resume.png' alt='Resume Account' /></a>
+ <?php
+ } else {
+ ?> <a
+ href=" <?php echo $this->url(
+ array(
+ 'module' => 'user',
+ 'controller' => 'person',
+ 'action' => 'suspend',
+ 'personID' => $person->getID()
+ ),
+ 'default',
+ true); ?>"> <img src='/media/img/suspend.png'
+ alt='Suspend Account' /></a> <?php
+ }
+}
?></div>
<div class='title'><?php echo $person->getTitle(); ?>&nbsp;<?php echo $person->getFirstname(); ?>&nbsp;<?php echo $person->getName(); ?></div>
<div class='subtitle'><?php echo $person->getEmail(); ?></div>
diff --git a/application/modules/user/views/scripts/person/owndetails.phtml b/application/modules/user/views/scripts/person/owndetails.phtml
index 88f124f..4547e23 100644
--- a/application/modules/user/views/scripts/person/owndetails.phtml
+++ b/application/modules/user/views/scripts/person/owndetails.phtml
@@ -1,27 +1,42 @@
<h1>Own Details</h1>
<style>
-label{width:150px !important;}
+label {
+ width: 150px !important;
+}
</style>
<?php if($this->editRight === true) echo $this->formButton('editperson', 'Edit', array(
'onclick' => 'self.location="/user/person/edit/"',
'class' => 'rightbutton'))?>
<div class='listelement'>
-<div class='element'>
- <div class='content'>
- <div class='title'><?php echo $this->person->getTitle()." ".$this->person->getFirstname()." ".$this->person->getName(); ?></div>
- <div class='subtitle'><?php echo $this->person->getEmail(); ?></div>
- <div class='details'>
- <label>Street:</label><div class='item'><?php echo $this->person->getStreet(); ?>&nbsp;</div>
- <label>Housenumber:</label><div class='item'><?php echo $this->person->getHousenumber(); ?>&nbsp;</div>
- <label>City:</label><div class='item'><?php echo $this->person->getCity(); ?>&nbsp;</div>
- <label>Postalcode:</label><div class='item'><?php echo $this->person->getPostalcode(); ?>&nbsp;</div>
- <label>Email:</label><div class='item'><?php echo $this->person->getEmail(); ?>&nbsp;</div>
- <label>Last Login:</label><div class='item'><?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?>&nbsp;</div>
- <label>Register Date:</label><div class='item'><?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?>&nbsp;</div>
+ <div class='element'>
+ <div class='content'>
+ <div class='title'><?php echo $this->person->getTitle()." ".$this->person->getFirstname()." ".$this->person->getName(); ?></div>
+ <div class='subtitle'><?php echo $this->person->getEmail(); ?></div>
+ <div class='details'><label>Street:</label>
+ <div class='item'><?php echo $this->person->getStreet(); ?>&nbsp;</div>
+ <label>Housenumber:</label>
+ <div class='item'><?php echo $this->person->getHousenumber(); ?>&nbsp;</div>
+ <label>City:</label>
+ <div class='item'><?php echo $this->person->getCity(); ?>&nbsp;</div>
+ <label>Postalcode:</label>
+ <div class='item'><?php echo $this->person->getPostalcode(); ?>&nbsp;</div>
+ <label>Email:</label>
+ <div class='item'><?php echo $this->person->getEmail(); ?>&nbsp;</div>
+ <label>Last Login:</label>
+ <div class='item'><?php if( $this->person->getLogindate()) echo date ('d. F Y - H:i', $this->person->getLogindate()) . " Uhr"; ?>&nbsp;</div>
+ <label>Register Date:</label>
+ <div class='item'><?php echo date ('d. F Y - H:i', $this->person->getRegisterdate()) . ' Uhr'; ?>&nbsp;</div>
+ <?php if($this->suspendRight === true)
+ {
+ ?> <label>Suspended:</label>
+ <div class='item'><?php if($this->person->getSuspended() == 1) echo "yes"; else echo "no"; ?></div>
+ <?php
+ }
+ ?>
</div>
</div>
- <div class='clear'>
-</div>
+ <div class='clear'></div>
+ </div>
</div>
<br />
<h2>Member in the following Groups:</h2>
@@ -66,6 +81,7 @@ if(count($this->groups)==0)
if(isset($this->groupRequestList)) {
?>
<br />
+
<h2>Requests:</h2>
<div class='listelement'>
<?php
diff --git a/application/modules/user/views/scripts/person/show.phtml b/application/modules/user/views/scripts/person/show.phtml
index c43bde3..2f2ef56 100644
--- a/application/modules/user/views/scripts/person/show.phtml
+++ b/application/modules/user/views/scripts/person/show.phtml
@@ -66,7 +66,18 @@
</div>
<div class='clear'></div>
</div>
+<?php if($this->suspendRight === true)
+{
+ ?>
+<div class='element'>
+<div class='content'>
+<div class="title">Suspended:&nbsp;<span class="noBold"><?php if($this->person->getSuspended() == 1) echo "yes"; else echo "no"; ?></span></div>
+</div>
+<div class='clear'></div>
</div>
+ <?php
+}
+?></div>
<br />
<h2>Member in the following Groups:</h2>
<div class='listelement'><?php if(count($this->groups)==0)
@@ -105,18 +116,18 @@ foreach($this->groupRequestList as $grouprequest) {
<div class='element'>
<div class='content'>
<div class='title'><?php echo $group->getTitle(); ?></div>
- <?php if($group->getDescription()) {
- ?>
+ <?php if($group->getDescription()) {
+ ?>
<div class='subtitle'><?php echo $group->getDescription(); ?></div>
- <?php
- } else {
- ?>
+ <?php
+ } else {
+ ?>
<div class='subtitle'>&nbsp;</div>
- <?php
- }
- ?></div>
+ <?php
+ }
+ ?></div>
</div>
- <?php
+ <?php
}
?></div>
<?php
diff --git a/pbs.sql b/pbs.sql
index 0fea159..2b1c527 100644
--- a/pbs.sql
+++ b/pbs.sql
@@ -81,6 +81,7 @@ CREATE TABLE IF NOT EXISTS `pbs_person` (
`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,
+ `suspended` tinyint(1) NOT NULL,
PRIMARY KEY (`personID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;
@@ -103,6 +104,7 @@ CREATE TABLE IF NOT EXISTS `pbs_membership` (
`groupID` int(11) NOT NULL,
`roleID` int(11) NOT NULL,
`personID` int(11) NOT NULL,
+ `suspended` tinyint(1) NOT NULL,
PRIMARY KEY (`membershipID`),
KEY `groupID` (`groupID`),
KEY `roleID` (`roleID`),
diff --git a/public/media/img/resume.png b/public/media/img/resume.png
new file mode 100644
index 0000000..a921ebc
--- /dev/null
+++ b/public/media/img/resume.png
Binary files differ
diff --git a/public/media/img/suspend.png b/public/media/img/suspend.png
new file mode 100644
index 0000000..54e23c5
--- /dev/null
+++ b/public/media/img/suspend.png
Binary files differ