Ejemplo n.º 1
0
 public function getAppaccount()
 {
     if ($this->appaccount == null) {
         $appDomain = new App_Domain_Account();
         $this->appaccount = $appDomain->getById($this->appaccount_id);
     }
     return $this->appaccount;
 }
Ejemplo n.º 2
0
 public function showAction()
 {
     if ($this->_isUserAllowed(App_Module_Acl::ACL_RESOURCE_APPACCOUNT, App_Module_Acl::ACL_RESOURCE_APPACCOUNT_PRIVILEGE_VIEW)) {
         $account = new App_Model_Account();
         if ($this->_hasParam('id')) {
             $id = $this->_getParam('id');
             if (!$id) {
                 $id = Zend_Auth::getInstance()->getIdentity()->appaccount_id;
             }
         } else {
             $id = Zend_Auth::getInstance()->getIdentity()->appaccount_id;
         }
         $domain = new App_Domain_Account();
         $account = $domain->getById($id);
         $this->view->account = $account;
     }
 }
Ejemplo n.º 3
0
 public function populateUser($data)
 {
     if (is_array($data)) {
         Agana_Data_BeanUtil::populate($this->_user, $data);
     } else {
         $this->setUser($data);
     }
     $ad = new App_Domain_Account();
     if (!is_null($this->_user->appaccount_id)) {
         $app = $ad->getById($this->_user->appaccount_id);
     } else {
         $app = $ad->getById(Zend_Auth::getInstance()->getIdentity()->appaccount_id);
     }
     $this->_user->setAppAccount($app);
     $pd = new Persons_Domain_Person();
     $person = $pd->getById($this->_user->person_id);
     $this->_user->setPerson($person);
 }
Ejemplo n.º 4
0
 public function populateRole($data)
 {
     if (is_array($data)) {
         if ($this->_role == null) {
             $this->_role = new User_Model_Role();
         }
         Agana_Data_BeanUtil::populate($this->_role, $data);
     } else {
         $this->setRole($data);
     }
     $ad = new App_Domain_Account();
     if (!is_null($this->_role->appaccount_id)) {
         $app = $ad->getById($this->_role->appaccount_id);
     } else {
         $app = $ad->getById(Zend_Auth::getInstance()->getIdentity()->appaccount_id);
     }
     $this->_role->setAppAccount($app);
     return $this->_role;
 }
Ejemplo n.º 5
0
 public function indexAction()
 {
     // TODO implementar configuração para saber se pode ser chamado este install
     try {
         $ad = new App_Domain_Account();
         $app = new App_Model_Account();
         $appName = 'Winponta Software';
         $app = $ad->getByName($appName);
         if (!$app->getId()) {
             $app->setName($appName);
             $app->setEmail('*****@*****.**');
             $ad->setAccount($app);
             $app->setId($ad->createInstall());
         }
         $ud = new User_Domain_User();
         $ud->createSuperAdmin(null, $app);
         $login = new Agana_Auth_Helper_Login();
         $login->redirectToLoginForm();
     } catch (Exception $ae) {
         $this->_helper->flashMessenger->addMessage(array('error' => $ae->getMessage()));
     }
 }
Ejemplo n.º 6
0
 /**
  *prepare data to be returned from query
  * @param array
  * @return User_Model_User
  */
 protected function _prepareReturnData($data, $returnArray = true)
 {
     if (is_array($data)) {
         if (!isset($data[0])) {
             $data = array(0 => $data);
         }
         $col = array();
         foreach ($data as $key => $row) {
             if ($row) {
                 $o = new User_Model_User($row);
                 $o->setLastLogin($row['last_login']);
                 $ad = new App_Domain_Account();
                 $app = $ad->getById($row['appaccount_id']);
                 $o->setAppAccount($app);
                 $pd = new Persons_Domain_Person();
                 $person = $pd->getById($row['person_id']);
                 $o->setPerson($person);
                 $col[] = $o;
             }
         }
         if ($returnArray) {
             return $col;
         } else {
             return $col[0];
         }
     } else {
         return null;
     }
 }