summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/Api/User.php5
-rw-r--r--app/Locale/ru_RU/translations.php4
-rw-r--r--doc/api-user-procedures.markdown42
-rw-r--r--tests/integration/ApiTest.php14
4 files changed, 63 insertions, 2 deletions
diff --git a/app/Api/User.php b/app/Api/User.php
index 63c222fe..9f26615d 100644
--- a/app/Api/User.php
+++ b/app/Api/User.php
@@ -21,6 +21,11 @@ class User extends \Kanboard\Core\Base
return $this->user->getById($user_id);
}
+ public function getUserByName($username)
+ {
+ return $this->user->getByUsername($username);
+ }
+
public function getAllUsers()
{
return $this->user->getAll();
diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php
index c52e622d..ed71914c 100644
--- a/app/Locale/ru_RU/translations.php
+++ b/app/Locale/ru_RU/translations.php
@@ -839,8 +839,8 @@ return array(
'Average time spent' => 'Затрачено времени в среднем',
'This chart show the average time spent into each column for the last %d tasks.' => 'Эта диаграмма показывает среднее время, проведенное задачами в каждой колонке за последний %d.',
'Average Lead and Cycle time' => 'Среднее время выполнения и цикла',
- 'Average lead time: ' => 'Среднее время выполнения',
- 'Average cycle time: ' => 'Среднее время цикла',
+ 'Average lead time: ' => 'Среднее время выполнения: ',
+ 'Average cycle time: ' => 'Среднее время цикла: ',
'Cycle Time' => 'Время цикла',
'Lead Time' => 'Время выполнения',
'This chart show the average lead and cycle time for the last %d tasks over the time.' => 'Эта диаграма показывает среднее время выполнения и цикла задачь в последние %d.',
diff --git a/doc/api-user-procedures.markdown b/doc/api-user-procedures.markdown
index 6ecf12c6..9b43e1e1 100644
--- a/doc/api-user-procedures.markdown
+++ b/doc/api-user-procedures.markdown
@@ -113,6 +113,48 @@ Response example:
}
```
+## getUserByName
+
+- Purpose: **Get user information**
+- Parameters:
+ - **username** (string, required)
+- Result on success: **user properties**
+- Result on failure: **null**
+
+Request example:
+
+```json
+{
+ "jsonrpc": "2.0",
+ "method": "getUserByName",
+ "id": 1769674782,
+ "params": {
+ "username": "biloute"
+ }
+}
+```
+
+Response example:
+
+```json
+{
+ "jsonrpc": "2.0",
+ "id": 1769674782,
+ "result": {
+ "id": "1",
+ "username": "biloute",
+ "password": "$2y$10$dRs6pPoBu935RpmsrhmbjevJH5MgZ7Kr9QrnVINwwyZ3.MOwqg.0m",
+ "role": "app-user",
+ "is_ldap_user": "0",
+ "name": "",
+ "email": "",
+ "google_id": null,
+ "github_id": null,
+ "notifications_enabled": "0"
+ }
+}
+```
+
## getAllUsers
- Purpose: **Get all available users**
diff --git a/tests/integration/ApiTest.php b/tests/integration/ApiTest.php
index 798bde42..8b970a6c 100644
--- a/tests/integration/ApiTest.php
+++ b/tests/integration/ApiTest.php
@@ -563,6 +563,20 @@ class Api extends PHPUnit_Framework_TestCase
$this->assertNull($this->client->getUser(2222));
}
+ public function testGetUserByName()
+ {
+ $user = $this->client->getUserByName('toto');
+ $this->assertNotFalse($user);
+ $this->assertTrue(is_array($user));
+ $this->assertEquals(2, $user['id']);
+
+ $user = $this->client->getUserByName('manager');
+ $this->assertNotEmpty($user);
+ $this->assertEquals('app-manager', $user['role']);
+
+ $this->assertNull($this->client->getUserByName('nonexistantusername'));
+ }
+
public function testUpdateUser()
{
$user = array();