← Back to team overview

phpdevshell team mailing list archive

[Bug 1032770] Re: ldap_sample addUser missing return true

 

See final return statement added to the addUser function below. This is
the code from the ldap_sample.class.php file which is provided in the
curent release.

class ldap_sample extends AUTH_ldap
{
    protected $source = array(
        'url' => 'ldap://bender.terascala.com',
        'defaults' => array(
            'user_group' => 2,
            'user_role' => 2
        ),
        'namePattern' => '%s@xxxxxxxxxxxxx',
        'defaultGroups' => array(11),
        'defaultRoles' => array(10),
        'required' => true
    );
 
    public function addUser($username, $password, $sourceName = null)
    {
        
        /* @var $newUser PHPDS_importUser */
        $newUser = $this->factory('PHPDS_importUser');
        $userData = array('user_id' => 0, 'user_name' => $username, 'user_password'=> $sourceName);
        $userData = array_merge($this->source['defaults'], $userData);
        $newUser->import($userData);
 
        if (is_array($this->source['defaultGroups'])) {
            foreach($this->source['defaultGroups'] as $gID) $newUser->addGroup($gID);
        }
        if (is_array($this->source['defaultRoles'])) {
            foreach($this->source['defaultRoles'] as $rID) $newUser->addRole($rID);
        }
        
        
        $newUser->save();
   
        //Attention:  The following return statement need added in order for this function to work correctly.
        return true;
    }
}

-- 
You received this bug notification because you are a member of
PHPDevShell, which is subscribed to PHPDevShell.
https://bugs.launchpad.net/bugs/1032770

Title:
  ldap_sample addUser missing return true

Status in Open Source PHP RAD Framework with UI.:
  New

Bug description:
  The ldap_sample class code contained LPAP Plugin docs needs a return
  statement that returns true added to the end of its addUser function.
  Without the return true statement the login will fail the first time
  even though the user successfully authenticated against the ldap
  server and was successfully added to the local databse.

To manage notifications about this bug go to:
https://bugs.launchpad.net/phpdevshell/+bug/1032770/+subscriptions


References