Mantis Bugtracker          
testlink.org

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006278TestLinkAPI - XMLRPCpublic2014-04-02 16:592014-04-02 17:52
ReporterTharindu_Amila 
Assigned To 
PrioritynormalSeverityfeature requestReproducibilityN/A
StatusnewResolutionopen 
PlatformOSOS Version
Product Version1.9.9 (2013 Q4 - bug fixing) 
Fixed in Version 
Summary0006278: Adding User Creation Functionality to the XMLRPC API
DescriptionTo automate creation of a User in TestLink for LDAP authentication.
TagsNo tags attached.
Database (MySQL,Postgres,etc)MYSQL
Browser
PHP Version
TestCaseID
QA Team - Task Workflow StatusTBD
Attached Files

- Relationships

-  Notes
(0020664)
Tharindu_Amila (reporter)
2014-04-02 17:07

Needs to change how cookie string is generated. Do not know the generating function.

/**
   *Add a user to the users table
   *Input must include a login
   *Input can include email,first name, last name and a role id
   *A dev key is needed in the struct if a role is being assigned to the user
   */
  public function insertUser($args){
    $this->_setArgs($args);
    if($this->args['login']!= null){
      $checkFunctions = array('authenticate');
      $status_ok = $this->_runChecks($checkFunctions)
                   && $this->userHasRight('user_role_assignment')
                   && $this->userHasRight('mgt_users');
      
      $sqlPart1 = "INSERT INTO `{$this->tables['users']}` (`login`";
      $sqlPart2 = "VALUES ('{$this->args['login']}'";
      
      if($this->args['email'] != null){
        $sqlPart1 .= ", `email`";
        $sqlPart2 .= ", '{$this->args['email']}'";
      }
      if($this->args['first'] != null){
        $sqlPart1 .= ", `first`";
        $sqlPart2 .= ", '{$this->args['first']}'";
      }
      if($this->args['last'] != null){
        $sqlPart1 .= ", `last`";
        $sqlPart2 .= ", '{$this->args['last']}'";
      }
      if($this->args['auth_method'] != null){
        $sqlPart1 .= ", `auth_method`";
        $sqlPart2 .= ", '{$this->args['auth_method']}'";
      }
      if($this->args['role_id'] != null){
        if($status_ok){
          $sqlPart1 .= ", `role_id`";
          $sqlPart2 .= ", '{$this->args['role_id']}'";
        }else{
          return $this->errors;
        }
      }
      $cookieString = $this->args['login'] . "cookieString";
      $sqlPart1 .= ", `cookie_string`";
      $sqlPart2 .= ", '{$cookieString}'";
      $sql = $sqlPart1 . ") " . $sqlPart2 . ") ;";
      $result = $this->dbObj->exec_query($sql);
      return $result;
    }else{
      return "invalid arguments";
    }
  }

- Issue History
Date Modified Username Field Change
2014-04-02 16:59 Tharindu_Amila New Issue
2014-04-02 17:07 Tharindu_Amila Note Added: 0020664
2014-04-02 17:52 fman QA Team - Task Workflow Status => TBD
2014-04-02 17:52 fman Priority high => normal



Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker