Hi every, see this code:

class sfGuardValidatorUserCustom extends sfGuardValidatorUser {
  protected function doClean($values) {
    $username = isset($values[$this->getOption('username_field')]) ? 
$values[$this->getOption('username_field')] : '';
    $password = isset($values[$this->getOption('password_field')]) ? 
$values[$this->getOption('password_field')] : '';
    $remember = isset($values[$this->getOption('rememeber_checkbox')]) ? 
$values[$this->getOption('rememeber_checkbox')] : '';

    // user exists?
    $user = sfGuardUserPeer::retrieveByUsername($username);

    $options = array('account_suffix'=>'@uci.cu','base_dn'=>'OU=UCI Domain 
Users, DC=uci,DC=cu','domain_controllers'=>array('uci.cu'));
    $ldap = new adLDAP($options);
    if ($ldap->authenticate($username, $password)) {
      if (!$user) {
        $user = new sfGuardUser();
        $user->setUsername($username);
        $user->setPassword($password);
        $user->save();
      }
    }

    if ($user != null) {
    // password is ok?
      if ($user->checkPassword($password)) {
        return array_merge($values, array('user' => $user));
      }
    }

    if ($this->getOption('throw_global_error')) {
      throw new sfValidatorError($this, 'invalid');
    }
    throw new sfValidatorErrorSchema($this, 
array($this->getOption('username_field') => new sfValidatorError($this, 
'invalid')));
  }
}

As you can see exists a LDAP validation here, I need to redirect a certain 
group of users to a class/method but I don't know how to do this from inside 
this class because always I try to use a redirect method I get a error because 
$this is a reference to $user which is a sfGuardUser. Can any help me?

Regards, 
Ing. Reynier Pérez Mira



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to