User-Api: add getMyPorjects (#1233)

This commit is contained in:
Timo Litzbarski
2015-09-18 14:18:34 +00:00
parent 55ca46ad75
commit 1fa72295f2
5 changed files with 68 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ abstract class Base extends \Core\Base
'createMyPrivateProject',
'getMyProjectsList',
'getMyOverdueTasks',
'getMyProjects',
);
private $both_allowed_procedures = array(

View File

@@ -57,4 +57,9 @@ class Me extends Base
{
return $this->taskFinder->getOverdueTasksByUser($this->userSession->getId());
}
public function getMyProjects()
{
return $this->formatProjects($this->project->getAllByIds($this->projectPermission->getActiveMemberProjectIds($this->userSession->getId())));
}
}

View File

@@ -172,6 +172,18 @@ class Project extends Base
{
return $this->db->table(self::TABLE)->asc('name')->findAll();
}
/**
* Get all projects with given Ids
*
* @access public
* @param integer[] $project_ids Projects id
* @return array
*/
public function getAllByIds($project_ids)
{
return $this->db->table(self::TABLE)->in('id', $project_ids)->asc('name')->findAll();
}
/**
* Get all project ids