public function execute($filterChain) { if ($this->isFirstCall() && !$this->getContext()->getUser()->isAuthenticated()) { if (sfConfig::get('sf_logging_enabled')) { sfContext::getInstance()->getLogger()->info('{sfFacebookApplicationFilter} Trying to authenticate the current user'); } $sfGuardUser = sfFacebook::getSfGuardUserByFacebookSession(); if ($sfGuardUser) { $this->getContext()->getUser()->signIn($sfGuardUser, true); $this->getContext()->getUser()->setCurrentFacebookUid(sfFacebookGuardAdapter::getUserProfileProperty($sfGuardUser, 'facebook_uid')); } else { if (sfConfig::get('sf_logging_enabled')) { sfContext::getInstance()->getLogger()->info('{sfFacebookApplicationFilter} No user found'); } } } $filterChain->execute(); }
/** * @see sfFilter */ public function execute($filterChain) { $cookieName = sfConfig::get('app_sf_guard_plugin_remember_cookie_name', 'sfRemember'); if ($this->isFirstCall() && $this->context->getUser()->isAnonymous() && ($cookie = $this->context->getRequest()->getCookie($cookieName))) { /* $q = Doctrine_Query::create() ->from('sfGuardRememberKey r') ->innerJoin('r.sfGuardUser u') ->where('r.remember_key = ?', $cookie); */ $sfGuardUser = sfFacebook::getGuardAdapter()->retrieveSfGuardUserByCookie($cookie); if ($sfGuardUser) { $this->getContext()->getUser()->signIn($sfGuardUser, true); $fb_sfGuardUser = sfFacebook::getSfGuardUserByFacebookSession(); if ($fb_sfGuardUser && $fb_sfGuardUser->getId() == $sfGuardUser->getId()) { $this->getContext()->getUser()->setCurrentFacebookUid(sfFacebookGuardAdapter::getUserProfileProperty($sfGuardUser, 'facebook_uid')); } } } $filterChain->execute(); }
/** * Creates an empty sfGuardUser with profile field Facebook UID set * * @param Integer $facebook_uid * @return sfGuardUser * @author fabriceb * @since 2009-08-11 */ public function createSfGuardUserWithFacebookUid($facebook_uid) { $con = Propel::getConnection(sfGuardUserPeer::DATABASE_NAME); return parent::createSfGuardUserWithFacebookUidAndCon($facebook_uid, $con); }
/** * Creates an empty sfGuardUser with profile field Facebook UID set * * @param Integer $facebook_uid * @return sfGuardUser * @author fabriceb * @since 2009-08-11 */ public function createSfGuardUserWithFacebookUid($facebook_uid) { $con = Doctrine::getConnectionByTableName('sfGuardUser'); return parent::createSfGuardUserWithFacebookUidAndCon($facebook_uid, $con); }