Skip to content
This repository was archived by the owner on Mar 17, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/rest-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
| `/api/v1/roles.list` | Gets all the roles in the system. | [Link](methods/roles/list.md) |
| `/api/v1/roles.sync` | Gets all the roles in the system which are updated after a given date. | [Link](methods/roles/sync.md) |
| `/api/v1/roles.addUserToRole` | Assign a role to an user. | [Link](methods/roles/addusertorole.md) |
| `/api/v1/roles.removeUserFromRole` | Unassign a role from an user. | [Link](methods/roles/removeuserfromrole.md) |
| `/api/v1/roles.getUsersInRole` | Gets the users that belongs to a role. | [Link](methods/roles/getusersinrole.md) |

### Push Token
Expand Down Expand Up @@ -381,4 +382,3 @@ When calling a production Rocket.Chat server, ensure it is running via HTTPS and
### Clojure

* [rocketchat-clojure](https://github.com/MalloZup/missile)

3 changes: 2 additions & 1 deletion api/rest-api/methods/roles/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ description: REST API Roles Methods
| `/api/v1/roles.sync` | List all roles on the server which are updated after given date. | [Link](sync.md) |
| `/api/v1/roles.create` | Create a new role. | [Link](create.md) |
| `/api/v1/roles.addUserToRole` | Edits permissions on the server. | [Link](addusertorole.md) |
| `/api/v1/roles.addUserToRole` | Assign a role to an user. | [Link](addusertorole.md) |
| `/api/v1/roles.removeUserFromRole` | Unassign a role from an user. | [Link](methods/roles/removeuserfromrole.md) |
| `/api/v1/roles.getUsersInRole` | Gets the users that belongs to a role. | [Link](getusersinrole.md) |

34 changes: 34 additions & 0 deletions api/rest-api/methods/roles/removeuserfromrole.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Role AddUserToRole

Unassign a role from an user. Optionally, you can unset this role for a specified scope.

| URL | Requires Auth | HTTP Method |
| :--- | :--- | :--- |
| `/api/v1/roles.removeUserFromRole` | `yes` | `POST` |

## Payload

| Argument | Example | Required | Description |
| :--- | :--- | :--- | :--- |
| `roleName` | `guest` | Required | The role name. |
| `username` | `rocket.chat` | Required | The user name. |
| `roomId` | `dK7vNYXMdHGLdukpL` | Optional | The scope where the role should be unset. |

## Example Call

```bash
curl -H "Content-type:application/json" \
-H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
http://localhost:3000/api/v1/roles.removeUserFromRole \
-d '{ "roleName": "guest" }' \
-d '{ "username": "rocket.chat" }' \
```

## Example Result

```javascript
{
"success": true
}
```