Merge pull-request #1722
This commit is contained in:
@@ -21,6 +21,11 @@ class User extends \Kanboard\Core\Base
|
|||||||
return $this->user->getById($user_id);
|
return $this->user->getById($user_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserByName($username)
|
||||||
|
{
|
||||||
|
return $this->user->getByUsername($username);
|
||||||
|
}
|
||||||
|
|
||||||
public function getAllUsers()
|
public function getAllUsers()
|
||||||
{
|
{
|
||||||
return $this->user->getAll();
|
return $this->user->getAll();
|
||||||
|
|||||||
@@ -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
|
## getAllUsers
|
||||||
|
|
||||||
- Purpose: **Get all available users**
|
- Purpose: **Get all available users**
|
||||||
|
|||||||
@@ -563,6 +563,20 @@ class Api extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertNull($this->client->getUser(2222));
|
$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()
|
public function testUpdateUser()
|
||||||
{
|
{
|
||||||
$user = array();
|
$user = array();
|
||||||
|
|||||||
Reference in New Issue
Block a user