diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-06-26 12:34:20 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-06-26 12:34:20 -0400 |
commit | c110dffefe259c13e60193fb81ebb9d4b79504de (patch) | |
tree | bdeda4701f4f85b6a20615515b54192d66faf501 | |
parent | b48c0cecbb1f687641594430260a67938d870cbb (diff) |
Added new API call: "getProjectByIdentifier"
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | app/Api/Procedure/ProjectProcedure.php | 7 | ||||
-rw-r--r-- | tests/integration/ProjectProcedureTest.php | 3 |
3 files changed, 12 insertions, 3 deletions
@@ -4,14 +4,15 @@ Version 1.0.31 (unreleased) New features: * Added application and project roles validation for API procedure calls +* Added new API call: "getProjectByIdentifier" Improvements: * Added argument owner_id and identifier to project API calls * Rewrite integration tests to run with Docker containers * Use the same task form layout everywhere -* Remove some tasks dropdown menus that are now available with task edit form -* Make embedded documentation available in multiple languages +* Removed some tasks dropdown menus that are now available with task edit form +* Make embedded documentation readable in multiple languages (if a translation is available) Bug fixes: diff --git a/app/Api/Procedure/ProjectProcedure.php b/app/Api/Procedure/ProjectProcedure.php index fe6b63e2..a580c8d9 100644 --- a/app/Api/Procedure/ProjectProcedure.php +++ b/app/Api/Procedure/ProjectProcedure.php @@ -25,6 +25,13 @@ class ProjectProcedure extends BaseProcedure return $this->formatProject($project); } + public function getProjectByIdentifier($identifier) + { + $project = $this->formatProject($this->projectModel->getByIdentifier($identifier)); + ProjectAuthorization::getInstance($this->container)->check($this->getClassName(), 'getProjectByIdentifier', $project['id']); + return $this->formatProject($project); + } + public function getAllProjects() { return $this->formatProjects($this->projectModel->getAll()); diff --git a/tests/integration/ProjectProcedureTest.php b/tests/integration/ProjectProcedureTest.php index a4b65241..69c2464f 100644 --- a/tests/integration/ProjectProcedureTest.php +++ b/tests/integration/ProjectProcedureTest.php @@ -93,7 +93,8 @@ class ProjectProcedureTest extends BaseProcedureTest $this->assertNotFalse($projectId); - $project = $this->app->getProjectById($projectId); + $project = $this->app->getProjectByIdentifier('MYPROJECTWITHIDENTIFIER'); + $this->assertEquals($projectId, $project['id']); $this->assertEquals('My project with an identifier', $project['name']); $this->assertEquals('MYPROJECTWITHIDENTIFIER', $project['identifier']); } |