Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001316TestLinkUsers and Rightspublic2008-01-22 23:552008-11-07 19:47
Reportertuergeist 
Assigned Tomhavlat 
PrioritynormalSeverityblockReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Fixed in Version1.8 Beta 1 
Summary0001316: User Administration -> View Users: Fatal error: Call to undefined method APIKey::getapikeys()
Descriptionlib/usermanagement/usersView.php - line 79
$api_users = APIKey::getAPIKey($db);

should be

$api_users = APIKey::getAPIKeys($db);

to be APIKeys API-correct;
Additional InformationVersion: SNAPSHOT-08-01-22

but this dos not work also...

1. $db is a DataBaseObject and not an integer.
2. APIKey::getAPIKeys could not be called as static-method due to use of member-variables as $this->db

I suggest it should be:

$apiKey = new APIKey();
$api_users = $apiKey->getAPIKey($user_id);
TagsNo tags attached.
Database (MySQL,Postgres,etc)
Browser
PHP Version
TestCaseID
QA Team - Task Workflow Status
Attached Files

- Relationships

-  Notes
(0003004)
tuergeist
2008-01-23 00:01

also check $api_users to be an array before handling over to SMARTY

if(!is_array($api_users))
{
    $api_users = array();
}

otherwise, Smarty throws an error while checking array_key_exists on a non-array
(0003009)
tuergeist
2008-01-23 00:38

## solution ##
lib/usermanagement/usersView.php - line 79
 $api_users = $apiKey->getAPIKeys()

lib/API/APIKey.php - add method:

    public function getAPIKeys()
    {
        $query = "SELECT id, script_key FROM users ";
        $result = $this->db->exec_query($query);
        $result = $this->db->fetchColumnsIntoMap($query, 'id', 'script_key');
        var_dump($result);
        return $result;
    }
(0003010)
tuergeist
2008-01-23 00:42

of course without
    var_dump($result);
;)
(0003038)
tuergeist
2008-01-24 00:00

improved and tested solution:

    /**
     * Get all script_keys from database
     * @return associative array[user-id] = script_key
     */
    public function getAPIKeys()
    {
        $query = "SELECT id, script_key FROM users WHERE script_key != NULL";
        $result = $this->db->exec_query($query);
        $result = $this->db->fetchColumnsIntoMap($query, 'id', 'script_key');
        return $result;
    }
(0003062)
mhavlat (reporter)
2008-01-25 19:46

All keys are generated and could be see on personal page from now. Admin could not care about keys.
It is possible, that admin will need to maintain it in future. But current functionality doesn't require it.

I'm not sure if this issue need to be solved as I miss response from Asiel about his reasons.

- Issue History
Date Modified Username Field Change
2008-01-22 23:55 tuergeist New Issue
2008-01-23 00:01 tuergeist Note Added: 0003004
2008-01-23 00:38 tuergeist Note Added: 0003009
2008-01-23 00:42 tuergeist Note Added: 0003010
2008-01-23 04:04 schlundus Status new => assigned
2008-01-23 04:04 schlundus Assigned To => mhavlat
2008-01-24 00:00 tuergeist Note Added: 0003038
2008-01-25 19:46 mhavlat Note Added: 0003062
2008-02-03 09:42 mhavlat Status assigned => resolved
2008-02-03 09:42 mhavlat Fixed in Version => next development version (1.8 Beta1)
2008-02-03 09:42 mhavlat Resolution open => fixed
2008-06-03 16:48 mhavlat Fixed in Version next development version (1.8 Beta1) => 1.8 Beta 1
2008-11-07 19:47 mhavlat Status resolved => closed



Copyright © 2000 - 2020 MantisBT Team
Powered by Mantis Bugtracker