static public function findBySiteLogin($nb_site, $login, $passwd, $active = true)
    {
        $retval = null;

        $nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
        if (is_numeric($nb_site_id)) {
            $retval = CNabuUser::buildObjectFromSQL(
                    "select u.*, su.nb_role_id "
                    . "from nb_user u, nb_site_user su "
                   . "where (u.nb_user_login='%login\$s' or lower(u.nb_user_email)=lower('%login\$s')) "
                     . "and u.nb_user_passwd='%passwd\$s' "
                     . ($active ? "and u.nb_user_validation_status='T' " : '')
                     . "and u.nb_user_id=su.nb_user_id "
                     . "and su.nb_site_id=%site_id\$d",
                    array(
                        'login' => $login,
                        'passwd' => CNabuUser::encodePassword($passwd),
                        'site_id' => $nb_site_id
                    )
            );
        }

        return $retval;
    }
static public function findBySiteLogin($nb_site, $login, $passwd, $active = true)
    {
        $retval = null;

        $nb_site_id = nb_getMixedValue($nb_site, 'nb_site_id');
        if (is_numeric($nb_site_id)) {
            $retval = CNabuUser::buildObjectFromSQL(
                    "select u.*, su.nb_role_id "
                    . "from nb_user u, nb_site_user su "
                   . "where (u.nb_user_login='%login\$s' or lower(u.nb_user_email)=lower('%login\$s')) "
                     . "and u.nb_user_passwd='%passwd\$s' "
                     . ($active ? "and u.nb_user_validation_status='T' " : '')
                     . "and u.nb_user_id=su.nb_user_id "
                     . "and su.nb_site_id=%site_id\$d",
                    array(
                        'login' => $login,
                        'passwd' => CNabuUser::encodePassword($passwd),
                        'site_id' => $nb_site_id
                    )
            );
        }

        return $retval;
    }
static public function findBySiteLogin ( $ nb_site , $ login , $ passwd , $ active = true ) { $ retval = null ; $ nb_site_id = nb_getMixedValue ( $ nb_site , 'nb_site_id' ) ; if ( is_numeric ( $ nb_site_id ) ) { $ retval = CNabuUser :: buildObjectFromSQL ( "select u.*, su.nb_role_id " . "from nb_user u, nb_site_user su " . "where (u.nb_user_login='%login\$s' or lower(u.nb_user_email)=lower('%login\$s')) " . "and u.nb_user_passwd='%passwd\$s' " . ( $ active ? "and u.nb_user_validation_status='T' " : '' ) . "and u.nb_user_id=su.nb_user_id " . "and su.nb_site_id=%site_id\$d" , array ( 'login' => $ login , 'passwd' => CNabuUser :: encodePassword ( $ passwd ) , 'site_id' => $ nb_site_id ) ) ; } return $ retval ; }
Find a user by his login data in a site.
@param mixed $nb_site Site instance, object containing a Site Id field or an Id.
@param string $login Login name
@param string $passwd Password in clear format
@param bool $active If true only active users are found else if false then looks for all validation statuses.
@return \nabu\data\security\CNabuUser Returns the instance representing the User if found or null if not.
Find a user by his login data in a site .