summaryrefslogtreecommitdiffstats
path: root/application/modules/user/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'application/modules/user/controllers')
-rw-r--r--application/modules/user/controllers/AuthController.php12
-rw-r--r--application/modules/user/controllers/PersonController.php49
2 files changed, 58 insertions, 3 deletions
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/PersonController.php b/application/modules/user/controllers/PersonController.php
index bbdf232..975b10e 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/");
+ }
+ }
+ }
}