Skip to content
Permalink
Browse files

More web_services implementation.

-added boilerplate class for tasks outlining the tasks functions i think
we should include within the api.
-added the config file changes to the setup script for web services.
-code tidy in setup file - got annoyed with things not lining up :)
-web services turned off now returns a 403 Forbidden message.
  • Loading branch information
Steve-Tredinnick committed Aug 28, 2014
1 parent ac65075 commit 0ca3d75e13da78aff316b74fb21f712eaf1391f5
Showing with 1,169 additions and 928 deletions.
  1. +55 −1 api/apis/api_projects.php
  2. +148 −0 api/apis/api_tasks.php
  3. +5 −2 api/index.php
  4. 0 cache/index.html
  5. +961 −925 setup/index.php
@@ -25,7 +25,11 @@ public function __construct()
/**
* Lists basic details of all projects listed in the database.
*
* Note this only returns projects that are public or where the user is a member of the project.
* @return array
*
* todo: Need to add access control to this section.
*/
public function getProjects()
{
@@ -36,7 +40,11 @@ public function getProjects()
/**
* Lists extended details of all projects in the database.
*
* Note this only returns projects that are public or where the user is a member of the project.
* @return array
*
* todo: Need to add access control to this section.
*/
public function getProjectsExtended()
{
@@ -53,6 +61,8 @@ public function getProjectsExtended()
*
* @param int $projectId The ID of the project to return
* @return array
*
* todo: Need to add access control to this section.
*/
public function getProject($projectId)
{
@@ -64,7 +74,6 @@ public function getProject($projectId)
/**
* <p>
* Gets all data fields for a project by its project id.
*
* Invoking this will return all of the data fields that are available for a project from the database, filtered by
@@ -74,6 +83,8 @@ public function getProject($projectId)
* @class AccessControl {@requires user}
* @param int $projectId The ID of the project to return
* @return array
*
* todo: Need to add access control to this section.
*/
public function getProjectExtended($projectId)
{
@@ -83,7 +94,50 @@ public function getProjectExtended($projectId)
return($query->fetchAll(PDO::FETCH_ASSOC));
}
/**
* Gets all groups that are associated to a project.
*
* Invoking this will return a list of groups that are associated to a project., filtered by
* the project id of the project that you want to return.
*
* @access protected
* @class AccessControl {@requires user}
* @param int $projectId The ID of the project to return
* @return array
*
* todo: Need to add access control to this section.
* todo: Need to code the api for this section.
*/
public function getProjectGroups($projectId)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* Gets all data fields for a project by its project id.
*
* Invoking this will return all project members and the groups they are associated to, filtered by
* the project id of the project that you want to return.
*
* @access protected
* @class AccessControl {@requires user}
* @param int $projectId The ID of the project to return
* @return array
*
* todo: Need to add access control to this section.
* todo: Need to code the api for this section.
*/
public function getProjectMembers($projectId)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
public function postNewProject($projectName)
{
}
public function putUpdateProject($projectId)
{
}
@@ -13,5 +13,153 @@
class api_tasks
{
/** @var PDO $_db */
private $_db = null;
/**
*
*/
public function __construct()
{
$this->_db = pdoDB::getConnection();
}
/**
* @param int $taskId
*/
public function getTaskDetailsBasic($taskId)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param int $taskId
*/
public function getTaskDetailsExtended($taskId)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param int $projectId
* @param int $limit
* @param int $offset
*/
public function getTasksFromAProject($projectId, $limit, $offset)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $startDate
* @param string $endDate
*/
public function getTasksByDateRange($startDate,$endDate)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param int $limit
*/
public function getLastUpdatedTasks($limit)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $type
*/
public function getTasksByType($type)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $severity
*/
public function getTasksBySeverity($severity)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $dueVersion
*/
public function getTasksByDueVersion($dueVersion)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $reportedVersion
*/
public function getTasksByReportedVersion($reportedVersion)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $category
*/
public function getTasksByCategory($category)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $status
*/
public function getTasksByStatus($status)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param int $percentage
*/
public function getTasksByPercentageComplete($percentage)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param string $taskType
* @param string $taskSeverity
* @param string $taskPriority
* @param string $taskDueVersion
* @param string $taskReportedVersion
* @param string $taskCategory
* @param string $taskStatus
* @param string $taskPercentage
*/
public function getTasksByComplexCriteria($taskType ="*",$taskSeverity ="*",$taskPriority ="*",$taskDueVersion ="*",$taskReportedVersion ="*",$taskCategory ="*",$taskStatus ="*",$taskPercentage ="*")
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param int $taskId
*/
public function putUpdateTask($taskId)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param int $taskId
* @param string $commentText
*/
public function postNewComment($taskId,$commentText)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
/**
* @param int $projectId
*/
public function postNewTask($projectId)
{
return "Not implemented yet...come back later, or contribute at flyspray.github.com";
}
}
@@ -12,12 +12,14 @@
require_once("includes.php");
//use the restler autoloader to load all api classes.
spl_autoload_register(AutoLoader::instance());
//allow the API Explorer to display API calls that are protected by user / group authentication.
Resources::$hideProtected = false;
if($config['allow_web_services']===true)
//check to determine if configuration settings prevent the use of web services.
if($config['allow_web_services']==1)
{
$r= new Restler();
$r->setSupportedFormats('JsonFormat', 'XmlFormat');
@@ -31,6 +33,7 @@
}
else
{
//Return a 403 forbidden message for all routes within the system.
header('HTTP/1.0 403 Forbidden');
echo "Your flyspray administrator has disabled web services for this instance of flyspray.";
}
No changes.

0 comments on commit 0ca3d75

Please sign in to comment.
You can’t perform that action at this time.