Changeset 1438

Show
Ignore:
Timestamp:
01/21/10 15:31:55 (3 years ago)
Author:
gbastien
Message:

Corrected some one-liners:

  • Permission error when deleting user role (#689)
  • Patch by Steven Kurylo to remove white spaces from authenticator arguments (#612)
  • Search for stakeholders has now same case-sensitivity as the user's network (#662)
  • Corrected (#613) patch by Hélène Gauthier
Location:
trunk/wifidog-auth
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1436 r1438  
    11# $Id$ 
    22 
    3 2009-12-17 
     32010-01-21 Geneviève Bastien <gbastien@versatic.net> 
     4 * Permission error when deleting user role (#689) 
     5 * Patch by Steven Kurylo to remove white spaces from authenticator arguments (#612) 
     6 * Search for stakeholders has now same case-sensitivity as the user's network (#662) 
     7 * Corrected (#613) patch by Hélène Gauthier 
     8 
     92009-12-17 Geneviève Bastien <gbastien@versatic.net> 
    410 * Code refactoring: Network, NodeGroup, Node inherit from HotspotGraphElement (#677) 
    511 
    6 2009-12-08 
     122009-12-08 Geneviève Bastien <gbastien@versatic.net> 
    713 * Added the concept of node group and hierarchy (in a not too clean way to start with, I will refactor the code before adding new functionalities to nodes and groups) (#246) 
    814 * Login and signup and logout script now receive the mac address as parameter (#675) 
  • trunk/wifidog-auth/wifidog/classes/Authenticator.php

    r1419 r1438  
    147147  
    148148        foreach ($network_array as $network) { 
    149                 if ($network->getName() == $default_network) 
     149                if ($network->getName() == $default_network->getName()) 
    150150                        $default_network_param = $network->getId(); 
    151151        } 
  • trunk/wifidog-auth/wifidog/classes/Mail.php

    r1424 r1438  
    368368         */ 
    369369        public function send() { 
    370             $phpmailerPath = 'lib/PHPMailer_v2.0.0/'; 
     370            $dir = new DirectoryIterator('lib'); 
     371            foreach ($dir as $fileinfo) { 
     372                if ($fileinfo->isDir() && (substr($fileinfo->getFilename(), 0, 9) == 'PHPMailer')) { 
     373                    $phpmailerPath = 'lib/' . $fileinfo->getFilename() . '/'; 
     374                } 
     375            } 
    371376            require_once ($phpmailerPath.'class.phpmailer.php'); 
    372377            require_once ($phpmailerPath.'class.smtp.php'); 
  • trunk/wifidog-auth/wifidog/classes/Network.php

    r1436 r1438  
    688688            } 
    689689        } 
     690        $params = array_map('trim',$params); 
    690691        return call_user_func_array(array (new ReflectionClass($this->_row['network_authenticator_class']), 'newInstance'), $params); 
    691692 
  • trunk/wifidog-auth/wifidog/classes/Role.php

    r1421 r1438  
    485485 
    486486        $retval = false; 
    487         if (Security::hasPermission('SERVER_PERM_EDIT_ROLES', Server::getServer())) { 
     487        if (Security::hasPermission(Permission::P('SERVER_PERM_EDIT_ROLES'), Server::getServer())) { 
    488488            $db = AbstractDb::getObject(); 
    489489            $id = $db->escapeString($this->getId()); 
  • trunk/wifidog-auth/wifidog/classes/User.php

    r1435 r1438  
    172172        return $object; 
    173173    } 
     174     
     175                /** Instantiate a user object 
     176     * @param $username The username of the user 
     177     * @param $account_origin Network:  The account origin 
     178     * @param &$errMsg An error message will be appended to this if the username is not empty, but the user doesn't exist. 
     179     * @return a User object, or null if there was an error 
     180     */ 
     181    public static function getUserByUsernameOrEmailAndOrigin($usernameOrEmail, Network $account_origin, &$errMsg = null) { 
     182        $db = AbstractDb::getObject(); 
     183        $object = null; 
     184 
     185        $username_str = $db->escapeString($usernameOrEmail); 
     186        $comparison = ($account_origin->getUsernamesCaseSensitive()? '=': 'ILike'); 
     187        $account_origin_str = $db->escapeString($account_origin->getId()); 
     188        $db->execSqlUniqueRes("SELECT user_id FROM users WHERE (username {$comparison} '$username_str' OR email ILike '$username_str') AND account_origin = '$account_origin_str'", $user_info, false); 
     189 
     190        if ($user_info != null) { 
     191            $object = self::getObject($user_info['user_id']); 
     192        } 
     193        else if (!empty($usernameOrEmail)) { 
     194            $errMsg .= sprintf(_("There is no user with username or email %s"),$usernameOrEmail); 
     195        } 
     196        return $object; 
     197    } 
    174198 
    175199    /** Instantiate a user object 
     
    857881            if (!empty ($_REQUEST[$name])) { 
    858882                $username = $_REQUEST[$name]; 
    859                 return self :: getUserByUsernameOrEmail($username, $errMsg); 
     883                return self :: getUserByUsernameOrEmailAndOrigin($username, $network, $errMsg); 
    860884            } else 
    861885            return null;