Mage_Adminhtml_System_AccountController Class Reference

Inheritance diagram for Mage_Adminhtml_System_AccountController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 indexAction ()
 saveAction ()

Protected Member Functions

 _isAllowed ()


Detailed Description

Definition at line 35 of file AccountController.php.


Member Function Documentation

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 89 of file AccountController.php.

00090     {
00091         return Mage::getSingleton('admin/session')->isAllowed('system/myaccount');
00092     }

indexAction (  ) 

Definition at line 37 of file AccountController.php.

00038     {
00039         $this->loadLayout();
00040         $this->_setActiveMenu('system/account');
00041         $this->_addContent($this->getLayout()->createBlock('adminhtml/system_account_edit'));
00042         $this->renderLayout();
00043     }

saveAction (  ) 

Definition at line 45 of file AccountController.php.

00046     {
00047         $userId = Mage::getSingleton('admin/session')->getUser()->getId();
00048         $pwd    = null;
00049 
00050         $user = Mage::getModel("admin/user")
00051                 ->setId($userId)
00052                 ->setUsername($this->getRequest()->getParam('username', false))
00053                 ->setFirstname($this->getRequest()->getParam('firstname', false))
00054                 ->setLastname($this->getRequest()->getParam('lastname', false))
00055                 ->setEmail(strtolower($this->getRequest()->getParam('email', false)));
00056         if ( $this->getRequest()->getParam('password', false) ) {
00057             $user->setPassword($this->getRequest()->getParam('password', false));
00058         }
00059 
00060         try {
00061             try {
00062                 $_isValid = Zend_Validate::is($user->getUsername(), 'NotEmpty')
00063                     && Zend_Validate::is($user->getFirstname(), 'NotEmpty')
00064                     && Zend_Validate::is($user->getLastname(), 'NotEmpty')
00065                     && Zend_Validate::is($user->getEmail(), 'EmailAddress');
00066 
00067                 if (!$_isValid) {
00068                     Mage::throwException(Mage::helper('adminhtml')->__('Error while saving account. Please check all required fields'));
00069                 }
00070                 if ($user->userExists()) {
00071                     Mage::throwException(Mage::helper('adminhtml')->__('User with the same User Name or Email aleady exists'));
00072                 }
00073                 $user->save();
00074                 Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Account successfully saved'));
00075             }
00076             catch (Mage_Core_Exception $e) {
00077                 throw $e;
00078             }
00079             catch (Exception $e) {
00080                 throw new Exception(Mage::helper('adminhtml')->__('Error while saving account. Please try again later'));
00081             }
00082         }
00083         catch (Exception $e) {
00084             Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
00085         }
00086         $this->getResponse()->setRedirect($this->getUrl("*/*/"));
00087     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:29 2009 for Magento by  doxygen 1.5.8