Add first draft of the user api

This commit is contained in:
Frederic Guillot
2015-07-29 17:42:48 -04:00
parent 2eeb58ae03
commit f595fb2786
22 changed files with 763 additions and 78 deletions

View File

@@ -12,6 +12,7 @@ class Project extends Base
{
public function getProjectById($project_id)
{
$this->checkProjectPermission($project_id);
return $this->formatProject($this->project->getById($project_id));
}
@@ -82,28 +83,4 @@ class Project extends Base
list($valid,) = $this->project->validateModification($values);
return $valid && $this->project->update($values);
}
private function formatProject($project)
{
if (! empty($project)) {
$project['url'] = array(
'board' => $this->helper->url->to('board', 'show', array('project_id' => $project['id']), '', true),
'calendar' => $this->helper->url->to('calendar', 'show', array('project_id' => $project['id']), '', true),
'list' => $this->helper->url->to('listing', 'show', array('project_id' => $project['id']), '', true),
);
}
return $project;
}
private function formatProjects($projects)
{
if (! empty($projects)) {
foreach ($projects as &$project) {
$project = $this->formatProject($project);
}
}
return $projects;
}
}