Fix getRoomIdByNameOrId to allow getting id from joined room

pull/3080/head^2
Marcelo Schmidt 10 years ago
parent 789051780c
commit c5eb95b57a
No known key found for this signature in database
GPG Key ID: CA48C21A7B66097E
  1. 5
      server/methods/getRoomIdByNameOrId.coffee

@ -3,7 +3,10 @@ Meteor.methods
room = RocketChat.models.Rooms.findOneById(rid) or RocketChat.models.Rooms.findOneByName(rid)
if room.usernames.indexOf(Meteor.user()?.username) isnt -1
return room._id
if room?.t isnt 'c' or RocketChat.authz.hasPermission(Meteor.userId(), 'view-c-room') isnt true
throw new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'joinRoom' }
throw new Meteor.Error 'error-not-allowed', 'Not allowed', { method: 'getRoomIdByNameOrId' }
return room._id

Loading…
Cancel
Save