Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
[NEW] Add permissions.list and permissions.update, and deprecate perm…
Browse files Browse the repository at this point in the history
…issions (#777)

* Add permissions.list and permissions.update, and deprecate permissions

* Fix CRLF issue, assuming that's what broke Travis
  • Loading branch information
vynmera authored and MartinSchoeler committed Jun 29, 2018
1 parent 2c16c52 commit f93b26c
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 44 deletions.
4 changes: 3 additions & 1 deletion _data/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@
- spotlight
- statistics
- statistics.list
- Permissions:
- list
- update
- Rooms:
- cleanHistory
- favorite
Expand Down Expand Up @@ -360,7 +363,6 @@
- update
- updateOwnBasicInfo
- Offset and Count and Sort Info
- Permissions
- Query and Fields Info
- Schema Definition
- Testing
Expand Down
4 changes: 3 additions & 1 deletion contributing/documentation/documentation-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ Here you can also find what articles are incomplete and missing.
- spotlight
- statistics
- statistics.list
- Permissions:
- list
- update
- Rooms:
- cleanHistory
- favorite
Expand Down Expand Up @@ -396,7 +399,6 @@ Here you can also find what articles are incomplete and missing.
- update
- updateOwnBasicInfo
- Offset and Count and Sort Info
- Permissions
- Query and Fields Info
- <span class="incomplete">[Schema Definition](../missing-and-outdated-list#Schema-Definition)</span>
- <span class="incomplete">[Testing](../missing-and-outdated-list#Testing)</span>
Expand Down
1 change: 1 addition & 0 deletions developer-guides/deprecation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ The methods and endpoints of the <b>Realtime API</b> and <b>Rest API</b>, respec
| :----------------------- | :----------------- | :-------------- |
| `/user.roles` | 0.63.0 | 0.66.0 |
| `/channels.cleanHistory` | 0.64.0 | 0.67.0 |
| `/permissions` | 0.66.0 | 0.69.0 |
9 changes: 8 additions & 1 deletion developer-guides/rest-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| `/api/v1/chat.pinMessage` | Pins a chat message to the message's channel. | [Link](chat/pinmessage/) |
| `/api/v1/chat.postMessage` | Posts a new chat message. | [Link](chat/postmessage/) |
| `/api/v1/chat.react` | Sets/unsets the user's reaction to an existing chat message. | [Link](chat/react/) |
| `/api/v1/chat.reportMessage` | Reports a message. | [Link](chat/reportmessage/) |
| `/api/v1/chat.reportMessage` | Reports a message. | [Link](chat/reportmessage/) |
| `/api/v1/chat.search` | Search for messages in a channel. | [Link](chat/search/) |
| `/api/v1/chat.starMessage` | Stars a chat message for the authenticated user. | [Link](chat/starmessage/) |
| `/api/v1/chat.sendMessage` | Send new chat message. | [Link](chat/sendmessage/) |
Expand All @@ -152,6 +152,13 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| `/api/v1/im.open` | Adds the direct message back to the list of direct messages. | [Link](im/open/) |
| `/api/v1/im.setTopic` | Sets a direct message topic. | [Link](im/settopic/) |

### Permissions

| Url | Short Description | Details Page |
| :--------------------------- | :------------------------------- | :-------------------------- |
| `/api/v1/permissions.list` | Lists permissions on the server. | [Link](permissions/list/) |
| `/api/v1/permissions.update` | Edits permissions on the server. | [Link](permissions/update/) |

### Rooms

| Url | Short Description | Details Page |
Expand Down
45 changes: 4 additions & 41 deletions developer-guides/rest-api/permissions/README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,6 @@
# Permissions
# Permission Methods

Returns all permissions from the server.

| URL | Requires Auth | HTTP Method |
| Url | Short Description | Details Page |
| :--- | :--- | :--- |
| `/api/v1/permissions` | `yes` | `GET` |

## Example Call

```bash
curl -H "X-Auth-Token: 6eWs4ECxUITYYoZ_bAYK5OE2srkxAepQqQA1cGGv3jK" \
-H "X-User-Id: hvzu8z6mHFigiXy6Y" \
http://localhost:3000/api/v1/permissions
```

## Example Result

```json
[
{
"_id": "access-permissions",
"roles": [
"admin"
],
"_updatedAt": "2018-01-25T13:03:20.879Z",
"meta": {
"revision": 0,
"created": 1516980515815,
"version": 0
},
"$loki": 1
},{
...
}
]
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.61.0 | Added. |
| `/api/v1/permissions.list` | Lists permissions on the server. | [Link](list/) |
| `/api/v1/permissions.update` | Edits permissions on the server. | [Link](update/) |
46 changes: 46 additions & 0 deletions developer-guides/rest-api/permissions/list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# List Permissions

Returns all permissions from the server.

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/permissions.list` | `yes` | `GET` |

## Example Call

```bash
curl -H "X-Auth-Token: 6eWs4ECxUITYYoZ_bAYK5OE2srkxAepQqQA1cGGv3jK" \
-H "X-User-Id: hvzu8z6mHFigiXy6Y" \
http://localhost:3000/api/v1/permissions.list
```

## Example Result

```json
{
"permissions": [
{
"_id": "access-permissions",
"roles": [
"admin"
],
"_updatedAt": "2018-01-25T13:03:20.879Z",
"meta": {
"revision": 0,
"created": 1516980515815,
"version": 0
},
"$loki": 1
},{
...
}
],
"success": true
}
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.66.0 | Added. |
54 changes: 54 additions & 0 deletions developer-guides/rest-api/permissions/update/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Update Permissions

Edits permissions on the server.

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/permissions.update` | `yes` | `POST` |

## Payload

| Argument | Example | Required | Description |
| :--- | :--- | :--- | :--- |
| `permissions` | `[{"_id": "access-permissions", "roles": ["admin"]}]` | Required | The array of roles to overwrite. |

## Example Call

```bash
curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
-H "Content-type:application/json" \
http://localhost:3000/api/v1/users.update \
-d '{"permissions": [{"_id": "access-permissions", "roles": ["admin"]}]}'
```

## Example Result

```json
{
"permissions": [
{
"_id": "access-permissions",
"roles": [
"admin"
],
"_updatedAt": "2018-01-25T13:03:20.879Z",
"meta": {
"revision": 0,
"created": 1516980515815,
"version": 0
},
"$loki": 1
},{
...
}
],
"success": true
}
```

## Change Log

| Version | Description |
| :--- | :--- |
| 0.66.0 | Added. |

0 comments on commit f93b26c

Please sign in to comment.