Example #1
0
 public function signup($aData)
 {
     $aData['isActive'] = 1;
     $today = date('Y-m-d h:i:s');
     $aData['registrationDate'] = $today;
     $aData['activationDate'] = $today;
     $aData['expirationDate'] = "2100-12-31 00:00:00";
     unset($aData['currentFund']);
     unset($aData['clientId']);
     $row = $this->save($aData);
     //Must also assign assign user as group:member_free
     $acl = Kutu_Acl_Manager::getAdapter();
     $acl->addUserToGroup($row->username, "member_free");
     //if saving to tbl user success, then send confirmation/welcome email
     $config = new Zend_Config_Ini(KUTU_ROOT_DIR . '/application/config/mail.ini', 'general');
     $siteOwner = "LGS Online";
     $siteName = "Lgsonline.com";
     $contactEmail = "*****@*****.**";
     $message = "---------------------------------------------------------------------\nWelcome to {$siteName}\nThank you very much for signing up as a member.\n---------------------------------------------------------------------\n\nDear {$row->firstname} {$row->lastname},\n\nEveryone at {$siteOwner} welcomes you as a valuable member. You will\nnow be able to take advantage of all the features available on our\nwebsite. You will now be able to access our Legal Database. \n\nYour new user information is provided below.\n\nUsername : {$row->username}\nPassword : ****** (hidden for security purposes)\n\nYou can login to your account any time. Please visit our website and\nclick on the \"Login\" link on our home page. If you have forgotten your\npassword, you can recover it back. Goto our Login screen and click\non the \"Password Reminder\" link on the navigation bar.\n\nIf you have any questions or if you need any help, please feel free\nto e-mail us at {$contactEmail}. Thank you and welcome again\nto {$siteName}.\n\nSincerely,\n{$siteOwner} Team\nhttp://www.{$siteName}/\nDate: {$today}\n\n---------------------------------------------------------------------\nNOTE: If you have not really signed up for this account and if you\nthink that someone else has used your e-mail address, please send us\nan e-mail at support@lgsonline.com.\n--------------------------------------------------------------------- ";
     $config = array('auth' => 'login', 'username' => '*****@*****.**', 'password' => 'putra');
     $transport = new Zend_Mail_Transport_Smtp('mail.langit.biz', $config);
     $mail = new Zend_Mail();
     $mail->setBodyText($message);
     $mail->setFrom('*****@*****.**', 'LGS Online');
     $mail->addTo($row->email, $row->firstname . ' ' . $row->lastname);
     $mail->setSubject('Welcome to LGS Online');
     try {
         $mail->send($transport);
     } catch (Zend_Exception $e) {
         //no need to do anything. The error is only about sending email.
         //maybe, we may set status in table user indicating that we never send
         // the user with welcome email.
     }
 }
Example #2
0
 public function isAllowed($itemGuid, $action, $section = 'content')
 {
     $auth = Zend_Auth::getInstance();
     if (!$auth->hasIdentity()) {
         return false;
     }
     $aclMan = Kutu_Acl_Manager::getAdapter();
     return $aclMan->isAllowed($auth->getIdentity()->username, $itemGuid, $action, $section);
 }
 public function isAllowedToView($itemGuid)
 {
     $auth = Zend_Auth::getInstance();
     $aclMan = Kutu_Acl_Manager::getAdapter();
     if (!$auth->hasIdentity()) {
         return $aclMan->getPermissionsOnContent('', 'everyone', $itemGuid);
     } else {
         $aReturn = $aclMan->getUserGroupIds($auth->getIdentity()->username);
         return $aclMan->getPermissionsOnContent('', $aReturn[1], $itemGuid);
     }
 }
Example #4
0
 static function manager()
 {
     return Kutu_Acl_Manager::getAdapter();
 }
 public function assigngroupAction()
 {
     $r = $this->getRequest();
     $guid = $r->getParam('guid');
     $tblUser = new Kutu_Core_Orm_Table_User();
     $row = $tblUser->find($guid)->current();
     $acl = Kutu_Acl_Manager::getAdapter();
     $aGroup = $acl->getGroups();
     $this->view->availableGroups = $aGroup;
     $aCurrentGroup = $acl->getUserGroupIds($row->username);
     $this->view->currentGroups = $aCurrentGroup;
     $this->view->rowUser = $row;
     $this->view->message = '';
     if ($r->isPost()) {
         $assignedGroups = $r->getParam('assignedGroups');
         //print_r($currentGroups);
         foreach ($aCurrentGroup as $currGroup) {
             $acl->removeUserFromGroup($row->username, $currGroup);
         }
         foreach ($assignedGroups as $group) {
             //echo $group;
             $acl->addUserToGroup($row->username, $group);
         }
         $aGroup = $acl->getGroups();
         $this->view->availableGroups = $aGroup;
         $aCurrentGroup = $acl->getUserGroupIds($row->username);
         $this->view->currentGroups = $aCurrentGroup;
         $this->view->message = "Data was Saved";
     }
 }
Example #6
0
 protected function _postInsert()
 {
     $acl = Kutu_Acl_Manager::getAdapter();
     $acl->addUser($this->username);
 }
 private function _migrateAllUsers()
 {
     $sqlSource = "SELECT * from tblPersonalization_User";
     $this->_dbSource->setFetchMode(Zend_Db::FETCH_OBJ);
     $results = $this->_dbSource->fetchAll($sqlSource);
     // do mapping
     if (count($results)) {
         foreach ($results as $row) {
             $tblUser = new Kutu_Core_Orm_Table_User();
             $rowsetUser = $tblUser->find($this->_guidPrefix . $row->UserID);
             if (count($rowsetUser) < 1) {
                 // do something
                 $rowUser = $tblUser->fetchNew();
                 $rowUser->guid = $this->_guidPrefix . $row->UserID;
                 $rowUser->username = $row->UserName;
                 $rowUser->password = is_null($row->Password) ? 'V3FXfFJzBnpVYg==' : $row->Password;
                 $rowUser->firstname = $row->FullName;
                 $rowUser->lastname = '';
                 $rowUser->email = $row->Email;
                 $rowUser->company = $row->CompanyName;
                 $rowUser->mainAddress = $row->Address;
                 $rowUser->zip = $row->ZIP;
                 $rowUser->phone = $row->Phone;
                 $rowUser->industryId = $row->CompBusLine;
                 $rowUser->isActive = is_null($row->isActive) ? 0 : $row->isActive;
                 $rowUser->createdDate = $row->DateCreate;
                 $rowUser->registrationDate = $rowUser->createdDate;
                 $sqlMembership = "SELECT * from tblMembership_Exp where User_ID={$row->UserID}";
                 $this->_dbSource->setFetchMode(Zend_Db::FETCH_OBJ);
                 $resultsMembership = $this->_dbSource->fetchAll($sqlMembership);
                 //print_r($resultsMembership);
                 //die();
                 if (count($resultsMembership)) {
                     $rowMembership = $resultsMembership[0];
                     $rowUser->fax = $rowMembership->Fax;
                     $rowUser->activationDate = $rowMembership->Activation_Date;
                     $rowUser->expirationDate = $rowMembership->Expiration_Date;
                 }
                 //if($row->UserID==157)
                 if (true) {
                     $rowUser->save();
                     //die();
                 }
                 //Must also assign assign user as group:member_free
                 $acl = Kutu_Acl_Manager::getAdapter();
                 $acl->addUserToGroup($rowUser->username, "member_free");
             } else {
             }
         }
     }
     die;
 }