Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Sorting 'Group By Type' hides private rooms

Open willihelm opened this issue 8 years ago • 2 comments

Description:

After updating to version 62.1 users complained about not seeing private rooms. I did not have the issue so I searched for the cause. I found out that it was an issue with the user permissions. All users have to have the permission 'view-p-room'. If the sorting is not set to 'group by type' the users can access their private rooms even if they do not have this permission.

Server Setup Information:

  • Version of Rocket.Chat Server: 62.1
  • Operating System: ubuntu
  • Deployment Method(snap/docker/tar/etc): tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: disabled
  • Node Version: 8.9.4
  • mongoDB Version: 3.4.13

Steps to Reproduce:

  1. uncheck the permission 'view-p-room' for users
  2. set sorting to 'group by type'
  3. all private channels are hidden

Expected behavior:

Actual behavior:

Relevant logs:

willihelm avatar Mar 07 '18 10:03 willihelm

~According to [1], this is expected behavior, I can't answer for sure though.~

I'd like someone to explain to me why this was designed this way (I won't mention the original author of the CoffeScript version because he seems to be away from Github for quite some time), because this is what I'm getting:

  • If user role has permission view-p-room

    • Expected behavior: User can see his private rooms merged and grouped by type.
    • Expected behavior after reading code linked above: User can see private rooms only when channels are merged (not grouped by type), because of the if section highlighted on [1].
    • Actual behavior: User can see his private rooms merged and grouped by type. (Expected).
  • If user role does not have permission view-p-room

    • Expected behavior: User can't see neither access private rooms
    • Expected behavior after reading code linked above: User can't see neither access private rooms, because RocketChat.authz.hasPermission(Meteor.userId(), 'view-p-room') will return false.
    • Actual behavior: User can see his private rooms when channels are merged, but not grouped by type.

If I remove the if highlighted by [1] and always push, normal users without the view-p-room permission can normally see their private rooms, which makes me think that RocketChat.authz.hasPermission(Meteor.userId(), 'view-p-room') could be faulty because this section of the code shouldn't be executed at all.

[1] :https://github.com/RocketChat/Rocket.Chat/blob/6cf49c0c396d73f9a52e692cc5968a5995f70475/server/methods/channelsList.js#L69

mikaelmello avatar Mar 08 '18 01:03 mikaelmello

@willihelm it was fixed in v0.63.1.

theorenck avatar Apr 09 '18 18:04 theorenck