Add Project List API
This commit is contained in:
@@ -64,7 +64,7 @@ class IDF_Views_Api
|
||||
$out = array();
|
||||
if ($request->method == 'GET') {
|
||||
// We give the details of the form
|
||||
$out['doc'] = 'A POST request against this url will allow you to create a new issue.';
|
||||
$out['help'] = 'A POST request against this url will allow you to create a new issue.';
|
||||
if ($request->user->hasPerm('IDF.project-owner', $request->project)
|
||||
or $request->user->hasPerm('IDF.project-member', $request->project)) {
|
||||
$out['status'] = array();
|
||||
@@ -76,16 +76,37 @@ class IDF_Views_Api
|
||||
} else {
|
||||
// We need to give back the results of the creation
|
||||
if (is_object($p) and 'IDF_Issue' == get_class($p)) {
|
||||
$out['mess'] = 'success';
|
||||
$out['message'] = 'success';
|
||||
$out['issue'] = $p->id;
|
||||
} else {
|
||||
$out['mess'] = 'error';
|
||||
$out['message'] = 'error';
|
||||
$out['errors'] = $p['form']->errors;
|
||||
}
|
||||
}
|
||||
return new Pluf_HTTP_Response_Json($out);
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the projects
|
||||
*/
|
||||
public $projectIndex_precond = array('IDF_Precondition::apiSetUser');
|
||||
|
||||
public function projectIndex($request, $match)
|
||||
{
|
||||
$view = new IDF_Views();
|
||||
$projects = $view->index($request, $match, true);
|
||||
|
||||
$data = array();
|
||||
foreach ($projects as $p) {
|
||||
$data[] = array("shortname" => $p->shortname, "name" => $p->name, "shortdesc" => $p->shortdesc, "private" => $p->private);
|
||||
}
|
||||
|
||||
$out = array();
|
||||
$out['message'] = 'success';
|
||||
$out['projects'] = $data;
|
||||
return new Pluf_HTTP_Response_Json($out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of tags to give them to the end users when doing a
|
||||
* GET request against a form. That way it is possible for them to
|
||||
|
Reference in New Issue
Block a user