Improve API calls for project permissions
This commit is contained in:
@@ -424,7 +424,7 @@ Request example:
|
|||||||
Response example:
|
Response example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
"jsonrpc": "2.0",
|
"jsonrpc": "2.0",
|
||||||
"id": 942472945,
|
"id": 942472945,
|
||||||
"result": true
|
"result": true
|
||||||
@@ -434,58 +434,103 @@ Response example:
|
|||||||
### getAllowedUsers
|
### getAllowedUsers
|
||||||
|
|
||||||
- Purpose: **Get allowed users for a given project**
|
- Purpose: **Get allowed users for a given project**
|
||||||
- Parameters: **project_id** (integer)
|
- Note: Only people explicitly allowed are part of this list, administrators are always authorized
|
||||||
|
- Parameters:
|
||||||
|
- **project_id** (integer, required)
|
||||||
- Result on success: Key/value pair of user_id and username
|
- Result on success: Key/value pair of user_id and username
|
||||||
- Result on failure: **false**
|
- Result on failure: **false**
|
||||||
|
|
||||||
Request example:
|
Request example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "getAllowedUsers",
|
||||||
|
"id": 1944388643,
|
||||||
|
"params": [
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Response example:
|
Response example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 1944388643,
|
||||||
|
"result": {
|
||||||
|
"1": "user1",
|
||||||
|
"2": "user2",
|
||||||
|
"3": "user3"
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### revokeUser
|
### revokeUser
|
||||||
|
|
||||||
- Purpose: **Revoke user access for a given project**
|
- Purpose: **Revoke user access for a given project**
|
||||||
- Parameters: **project_id** (integer), **user_id** (integer)
|
- Parameters:
|
||||||
|
- **project_id** (integer, required)
|
||||||
|
- **user_id** (integer, required)
|
||||||
- Result on success: **true**
|
- Result on success: **true**
|
||||||
- Result on failure: **false**
|
- Result on failure: **false**
|
||||||
|
|
||||||
Request example:
|
Request example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "revokeUser",
|
||||||
|
"id": 251218350,
|
||||||
|
"params": [
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Response example:
|
Response example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 251218350,
|
||||||
|
"result": true
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### allowUser
|
### allowUser
|
||||||
|
|
||||||
- Purpose: **Grant user access for a given project**
|
- Purpose: **Grant user access for a given project**
|
||||||
- Parameters: **project_id** (integer), **user_id** (integer)
|
- Parameters:
|
||||||
|
- **project_id** (integer, required)
|
||||||
|
- **user_id** (integer, required)
|
||||||
- Result on success: **true**
|
- Result on success: **true**
|
||||||
- Result on failure: **false**
|
- Result on failure: **false**
|
||||||
|
|
||||||
Request example:
|
Request example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "allowUser",
|
||||||
|
"id": 2111451404,
|
||||||
|
"params": [
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Response example:
|
Response example:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 2111451404,
|
||||||
|
"result": true
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ $server->register('removeColumn', function($column_id) use ($board) {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Projects permissions procedures
|
* Project permissions procedures
|
||||||
*/
|
*/
|
||||||
$server->register('getAllowedUsers', function($project_id) use ($project) {
|
$server->register('getAllowedUsers', function($project_id) use ($project) {
|
||||||
return $project->getUsersList($project_id, false, false);
|
return $project->getUsersList($project_id, false, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user