public function isPasswordValid(sfAuthUser $user, $password) { if ($user->getPassword() === sfAuthUtil::getHashedPasswordBySaltAndString($user->getSalt(), $password)) { return true; } //if we havent returned yet use the event dispatcher to notify until an event returns true $event = $this->dispatcher->notifyUntil(new sfEvent($this, 'sf_auth.is_password_valid')); if ($event->isProcessed()) { return $event->getReturnValue(); } return false; }
public function getAllByUser(sfAuthUser $user) { $q = $this->createQuery('c'); $q->leftjoin('c.sfAuthUserCredential uc'); $q->leftjoin('c.sfAuthGroup g'); $q->leftjoin('g.sfAuthGroupCredential cg'); $q->leftjoin('cg.sfAuthGroup cgg'); $q->leftjoin('cgg.sfAuthUserGroup ugg'); $q->addWhere('ugg.sf_auth_user_id = ? OR uc.sf_auth_user_id = ?', array($user->getId(), $user->getId())); $q->groupby('c.id'); //Aggregate $credentials = array(); foreach ($q->execute(array(), Doctrine::HYDRATE_ARRAY) as $credential) { $credentials[] = $credential['name']; } return $credentials; }