Skip to content

[error-room-not-found] when trying to add user to a private group from API with [add-user-to-any-p-room] permission #10639

@driesmeyers

Description

@driesmeyers

Description:

I'm trying to add a registered user to a private group. I'm posting a request via API (https://rocket.chat/docs/developer-guides/rest-api/groups/invite/) with admin credentials. The admin is not a member of the private group but should be able to add another user with the add-user-to-any-p-room permission. I keep getting 'error-room-not-found' as error type. However the request seems to work when the admin is member of the private group.

Server Setup Information:

  • Version of Rocket.Chat Server: 0.64.0-develop
  • Operating System: macOS 10.13.4 High Sierra
  • Deployment Method(snap/docker/tar/etc):
  • Number of Running Instances: 1
  • DB Replicaset Oplog: Enabled
  • Node Version: v8.11.1
  • mongoDB Version: 3.4.10

Steps to Reproduce:

  1. Enable add-user-to-any-p-room permission for user that is sending the request
  2. Create second user
  3. Set request headers x-auth-token and x-user-id
  4. Send POST request to http://localhost:3000/api/v1/groups.invite
    Body:
    {
    "userId": "75c9mWS83yCTcqn2X", // straight from database
    "roomId": "dnqSmTG52uCzyPm3j" // straight from database
    }

Same request works when the admin is member of the private group.

Expected behavior:

User is added to the group while admin is still not a member.

Actual behavior:

Response with error type "error-room-not-found'

Relevant logs:

Nothing relevant coming from logs.

Response:
{
"success": false,
"error": "The required "roomId" or "roomName" param provided does not match any group [error-room-not-found]",
"errorType": "error-room-not-found"
}

error thrown in Rocket.Chat/packages/rocketchat-api/server/v1/groups.js line 17

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions