Skip to content

Commit

Permalink
Check for mention-all permission in room scope (#8931)
Browse files Browse the repository at this point in the history
Closes #8033
  • Loading branch information
sampaiodiego authored and geekgonecrazy committed Dec 1, 2017
1 parent 4f4a90c commit 9c34c10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/rocketchat-lib/server/methods/filterATAllTag.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ RocketChat.callbacks.add('beforeSaveMessage', function(message) {
if (message.mentions != null &&
_.pluck(message.mentions, '_id').some((item) => item === 'all')) {

// Check if the user has permissions to use @all.
if (!RocketChat.authz.hasPermission(message.u._id, 'mention-all')) {
// Check if the user has permissions to use @all in both global and room scopes.
if (!RocketChat.authz.hasPermission(message.u._id, 'mention-all') && !RocketChat.authz.hasPermission(message.u._id, 'mention-all', message.rid)) {

// Get the language of the user for the error notification.
const language = RocketChat.models.Users.findOneById(message.u._id).language;
Expand Down

0 comments on commit 9c34c10

Please sign in to comment.