Exemple #1
0
 public function __construct()
 {
     $db = null;
     doDBConnect($db);
     parent::__construct($db);
     $this->object_table = $this->tables["users"];
 }
Exemple #2
0
 * @link 		http://www.teamst.org/index.php
 * 
 * @internal Revisions
 * 20100202 - franciscom - BUGID 0003129: After login failure blank page is displayed
 * 20100127 - eloff - Send localized login form strings with response to ajaxcheck
 * 20100124 - eloff - Added login functionality via ajax
 **/
require_once 'lib/functions/configCheck.php';
checkConfiguration();
require_once 'config.inc.php';
require_once 'common.php';
require_once 'doAuthorize.php';
$templateCfg = templateConfiguration();
$doRender = false;
// BUGID 0003129
$op = doDBConnect($db);
if (!$op['status']) {
    $smarty = new TLSmarty();
    $smarty->assign('title', lang_get('fatal_page_title'));
    $smarty->assign('content', $op['dbms_msg']);
    $smarty->display('workAreaSimple.tpl');
    tLog('Connection fail page shown.', 'ERROR');
    exit;
}
$args = init_args();
$gui = init_gui($db, $args);
switch ($args->action) {
    case 'doLogin':
    case 'ajaxlogin':
        doSessionStart();
        unset($_SESSION['basehref']);
Exemple #3
0
require_once 'config.inc.php';
require_once 'common.php';
require_once 'users.inc.php';
require_once 'email_api.php';
$templateCfg = templateConfiguration();
if (!config_get('user_self_signup')) {
    $smarty = new TLSmarty();
    $smarty->assign('title', lang_get('fatal_page_title'));
    $smarty->assign('content', lang_get('error_self_signup_disabled'));
    $smarty->assign('link_to_op', "login.php");
    $smarty->assign('hint_text', lang_get('link_back_to_login'));
    $smarty->display('workAreaSimple.tpl');
    exit;
}
$args = init_args();
doDBConnect($db, database::ONERROREXIT);
$message = lang_get('your_info_please');
if ($args->doEditUser) {
    if (strcmp($args->password, $args->password2)) {
        $message = lang_get('passwd_dont_match');
    } else {
        $user = new tlUser();
        $rx = $user->checkPasswordQuality($args->password);
        if ($rx['status_ok'] >= tl::OK) {
            $result = $user->setPassword($args->password);
            if ($result >= tl::OK) {
                $user->login = $args->login;
                $user->emailAddress = $args->email;
                $user->firstName = $args->firstName;
                $user->lastName = $args->lastName;
                $result = $user->writeToDB($db);
Exemple #4
0
/**
 * General GUI page initialization procedure
 * - init session
 * - init database
 * - check rights
 * - initialize project data (if requested)
 * 
 * @param integer $db DB connection identifier
 * @param boolean $initProject (optional) Set true if adjustment of Product or
 * 		Test Plan is required; default is FALSE
 * @param boolean $bDontCheckSession (optional) Set to true if no session should be
 * 		 started
 */
function testlinkInitPage(&$db, $initProject = FALSE, $bDontCheckSession = false, $userRightsCheckFunction = null)
{
    doSessionStart();
    setPaths();
    set_dt_formats();
    doDBConnect($db);
    static $pageStatistics = null;
    if (!$pageStatistics && config_get('log_level') == 'EXTENDED') {
        $pageStatistics = new tlPageStatistics($db);
    }
    if (!$bDontCheckSession) {
        checkSessionValid($db);
    }
    if ($userRightsCheckFunction) {
        checkUserRightsFor($db, $userRightsCheckFunction);
    }
    // adjust Product and Test Plan to $_SESSION
    if ($initProject) {
        initProject($db, $_REQUEST);
    }
    // used to disable the attachment feature if there are problems with repository path
    /** @TODO this check should not be done anytime but on login and using */
    global $g_repositoryType;
    global $g_attachments;
    global $g_repositoryPath;
    $g_attachments->disabled_msg = "";
    if ($g_repositoryType == TL_REPOSITORY_TYPE_FS) {
        $ret = checkForRepositoryDir($g_repositoryPath);
        if (!$ret['status_ok']) {
            $g_attachments->enabled = FALSE;
            $g_attachments->disabled_msg = $ret['msg'];
        }
    }
}
Exemple #5
0
/**
 *
 */
function setUpEnvForAnonymousAccess(&$dbHandler, $apikey, $rightsCheck = null, $opt = null)
{
    $my = array('opt' => array('setPaths' => false, 'clearSession' => false));
    $my['opt'] = array_merge($my['opt'], (array) $opt);
    if ($my['opt']['clearSession']) {
        $_SESSION = null;
    }
    doSessionStart($my['opt']['setPaths']);
    if (isset($_SESSION['locale']) && !is_null($_SESSION['locale'])) {
        setDateTimeFormats($_SESSION['locale']);
    }
    doDBConnect($dbHandler);
    // @since 1.9.14
    $checkMode = 'paranoic';
    if (property_exists($rightsCheck->args, 'envCheckMode')) {
        $checkMode = $rightsCheck->args->envCheckMode;
    }
    switch ($checkMode) {
        case 'hippie':
            $tk = array('testplan', 'testproject');
            break;
        default:
            $tk[] = intval($rightsCheck->args->tplan_id) != 0 ? 'testplan' : 'testproject';
            break;
    }
    foreach ($tk as $ak) {
        $item = getEntityByAPIKey($dbHandler, $apikey, $ak);
        if (!is_null($item)) {
            break;
        }
    }
    $status_ok = false;
    if (!is_null($item)) {
        $_SESSION['lastActivity'] = time();
        $userObj = new tlUser();
        $_SESSION['currentUser'] = $userObj;
        $_SESSION['userID'] = -1;
        $_SESSION['locale'] = config_get('default_language');
        // if user do this:
        // 1. login to test link
        // 2. get direct link and open in new tab or new window while still logged
        // 3. logout
        // If user refresh tab / window open on (2), because on (3) we destroyed
        // session we have loose basehref, and we are not able to recreate it.
        // Without basehref we are not able to get CSS, JS, etc.
        // In this situation we destroy session, this way user is forced to login
        // again in one of two ways
        // a. using the direct link
        // b. using traditional login
        // In both way we assure that behaivour will be OK.
        //
        if (!isset($_SESSION['basehref'])) {
            // echo $rightsCheck->redirect_target;
            session_unset();
            session_destroy();
            if (property_exists($rightsCheck, 'redirect_target') && !is_null($rightsCheck->redirect_target)) {
                redirect($rightsCheck->redirect_target);
            } else {
                // best guess for all features that live on ./lib/results/
                redirect("../../login.php?note=logout");
            }
            exit;
        }
        if (!is_null($rightsCheck->method)) {
            checkUserRightsFor($dbHandler, $rightsCheck->method, true);
        }
        $status_ok = true;
    }
    return $status_ok;
}
Exemple #6
0
function dashboardInit()
{
    # connect to the datbase
    doDBConnect() or die("Could not connect to DB");
    ini_set('session.gc_maxlifetime', 7200);
    ini_set('session.gc_probability', 1);
    ini_set('session.gc_divisor', 1);
    ini_set('session.bug_compat_42', 0);
    ini_set('session.bug_compat_warn', 0);
    session_save_path("/var/lib/php5/");
    session_get_cookie_params();
    session_start();
    setPaths();
    checkSessionValid();
}
Exemple #7
0
require_once 'config.inc.php';
require_once 'common.php';
require_once 'users.inc.php';
require_once 'email_api.php';
$templateCfg = templateConfiguration();
if (!config_get('user_self_signup')) {
    $smarty = new TLSmarty();
    $smarty->assign('title', lang_get('fatal_page_title'));
    $smarty->assign('content', lang_get('error_self_signup_disabled'));
    $smarty->assign('link_to_op', "login.php");
    $smarty->assign('hint_text', lang_get('link_back_to_login'));
    $smarty->display('workAreaSimple.tpl');
    exit;
}
$args = init_args();
doDBConnect($db);
$message = lang_get('your_info_please');
if ($args->doEditUser) {
    if (strcmp($args->password, $args->password2)) {
        $message = lang_get('passwd_dont_match');
    } else {
        $user = new tlUser();
        $result = $user->setPassword($args->password);
        if ($result >= tl::OK) {
            $user->login = $args->login;
            $user->emailAddress = $args->email;
            $user->firstName = $args->first;
            $user->lastName = $args->last;
            $result = $user->writeToDB($db);
        }
        if ($result >= tl::OK) {
Exemple #8
0
 public function __construct()
 {
     $db = null;
     doDBConnect($db);
     parent::__construct($db);
 }
 /**
  */
 public function __construct()
 {
     // We are following Slim naming convention
     $this->app = new \Slim\Slim();
     $this->app->contentType('application/json');
     // test route with anonymous function
     $this->app->get('/who', function () {
         echo __CLASS__ . ' : Get Route /who';
     });
     $this->app->get('/whoAmI', array($this, 'authenticate'), array($this, 'whoAmI'));
     $this->app->get('/testprojects', array($this, 'authenticate'), array($this, 'getProjects'));
     $this->app->get('/testprojects/:id', array($this, 'authenticate'), array($this, 'getProjects'));
     $this->app->get('/testprojects/:id/testcases', array($this, 'authenticate'), array($this, 'getProjectTestCases'));
     $this->app->get('/testprojects/:id/testplans', array($this, 'authenticate'), array($this, 'getProjectTestPlans'));
     $this->app->post('/testprojects', array($this, 'authenticate'), array($this, 'createTestProject'));
     $this->app->post('/executions', array($this, 'authenticate'), array($this, 'createTestCaseExecution'));
     $this->app->post('/testplans', array($this, 'authenticate'), array($this, 'createTestPlan'));
     $this->app->post('/testplans/:id', array($this, 'authenticate'), array($this, 'updateTestPlan'));
     $this->app->post('/testsuites', array($this, 'authenticate'), array($this, 'createTestSuite'));
     $this->app->post('/testcases', array($this, 'authenticate'), array($this, 'createTestCase'));
     // $this->app->get('/testplans/:id', array($this,'getTestPlan'));
     $this->db = new database(DB_TYPE);
     $this->db->db->SetFetchMode(ADODB_FETCH_ASSOC);
     doDBConnect($this->db, database::ONERROREXIT);
     $this->tcaseMgr = new testcase($this->db);
     $this->tprojectMgr = new testproject($this->db);
     $this->tsuiteMgr = new testsuite($this->db);
     $this->tplanMgr = new testplan($this->db);
     $this->tplanMetricsMgr = new tlTestPlanMetrics($this->db);
     $this->reqSpecMgr = new requirement_spec_mgr($this->db);
     $this->reqMgr = new requirement_mgr($this->db);
     $this->cfieldMgr = $this->tprojectMgr->cfield_mgr;
     $this->tables = $this->tcaseMgr->getDBTables();
     $this->cfg = array();
     $conf = config_get('results');
     foreach ($conf['status_label_for_exec_ui'] as $key => $label) {
         $this->cfg['exec']['statusCode'][$key] = $conf['status_code'][$key];
     }
     //if( isset($this->cfg['exec']['statusCode']['not_run']) )
     //{
     //  unset($this->cfg['exec']['statusCode']['not_run']);
     //}
     $this->cfg['exec']['codeStatus'] = array_flip($this->cfg['exec']['statusCode']);
     $this->cfg['tcase']['defaults']['importance'] = config_get('testcase_importance_default');
     $this->cfg['tcase']['defaults']['executionType'] = TESTCASE_EXECUTION_TYPE_MANUAL;
     $this->cfg['tcase']['status'] = config_get('testCaseStatus');
     $this->debugMsg = ' Class:' . __CLASS__ . ' - Method: ';
 }
 /**
  */
 public function __construct()
 {
     // We are following Slim naming convention
     $this->app = new \Slim\Slim();
     $this->app->contentType('application/json');
     // test route with anonymous function
     $this->app->get('/who', function () {
         echo __CLASS__ . ' : Get Route /who';
     });
     $this->app->get('/whoAmI', array($this, 'authenticate'), array($this, 'whoAmI'));
     $this->app->get('/testprojects', array($this, 'authenticate'), array($this, 'getProjects'));
     $this->app->get('/testprojects/:id', array($this, 'authenticate'), array($this, 'getProjects'));
     $this->app->get('/testprojects/:id/testcases', array($this, 'authenticate'), array($this, 'getProjectTestCases'));
     $this->app->get('/testprojects/:id/testplans', array($this, 'authenticate'), array($this, 'getProjectTestPlans'));
     $this->app->post('/testprojects', array($this, 'authenticate'), array($this, 'createTestProject'));
     $this->app->post('/executions', array($this, 'authenticate'), array($this, 'createTestCaseExecution'));
     $this->app->post('/testplans', array($this, 'authenticate'), array($this, 'createTestPlan'));
     $this->app->post('/testplans/:id', array($this, 'authenticate'), array($this, 'updateTestPlan'));
     $this->app->post('/testsuites', array($this, 'authenticate'), array($this, 'createTestSuite'));
     $this->app->post('/testcases', array($this, 'authenticate'), array($this, 'createTestCase'));
     // $this->app->get('/testplans/:id', array($this,'getTestPlan'));
     $this->db = new database(DB_TYPE);
     $this->db->db->SetFetchMode(ADODB_FETCH_ASSOC);
     doDBConnect($this->db, database::ONERROREXIT);
     $this->tcaseMgr = new testcase($this->db);
     $this->tprojectMgr = new testproject($this->db);
     $this->tsuiteMgr = new testsuite($this->db);
     $this->tplanMgr = new testplan($this->db);
     $this->tplanMetricsMgr = new tlTestPlanMetrics($this->db);
     $this->reqSpecMgr = new requirement_spec_mgr($this->db);
     $this->reqMgr = new requirement_mgr($this->db);
     $this->cfieldMgr = $this->tprojectMgr->cfield_mgr;
     $this->tables = $this->tcaseMgr->getDBTables();
     $resultsCfg = config_get('results');
     foreach ($resultsCfg['status_label_for_exec_ui'] as $key => $label) {
         $this->statusCode[$key] = $resultsCfg['status_code'][$key];
     }
     if (isset($this->statusCode['not_run'])) {
         unset($this->statusCode['not_run']);
     }
     $this->codeStatus = array_flip($this->statusCode);
 }
Exemple #11
0
/**
 * General GUI page initialization procedure
 * - init session
 * - init database
 * 
 * @param integer $db DB connection identifier
 * @param boolean $checkSession (optional) 
 */
function testlinkInitPage(&$db, $checkSession = true)
{
    doSessionStart();
    setPaths();
    set_dt_formats();
    doDBConnect($db);
    static $pageStatistics = null;
    if (!$pageStatistics && config_get('log_level') == 'EXTENDED') {
        $pageStatistics = new tlPageStatistics($db);
    }
    if ($checkSession) {
        checkSessionValid($db);
    }
}