-
Notifications
You must be signed in to change notification settings - Fork 11.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NEW] Add permission view-broadcast-member-list
#10753
Merged
rodrigok
merged 14 commits into
RocketChat:develop
from
cardoso:imp/broadcast_permissions
May 21, 2018
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fc145d9
Add view-broadcast-member-list permission
cardoso 082b21a
Add view-broadcast-member-list to i18n file
cardoso 8c5a5d0
Fix not looking up view-broadcast-member-list permission per room
cardoso bdf4410
REST API: Don't allow users without permission to fetch broadcast roo…
cardoso f0b7922
Remove trailing space
cardoso 7a235a2
Merge branch 'develop' of https://github.com/RocketChat/Rocket.Chat i…
cardoso 885a208
Merge branch 'develop' into imp/broadcast_permissions
cardoso 78b30ab
DDP: getUsersOfRoom disallow users without permission to fetch broadc…
cardoso 4bbd7a6
Merge branch 'imp/broadcast_permissions' of https://github.com/cardos…
cardoso f36aa43
Merge branch 'develop' into imp/broadcast_permissions
cardoso a5d30b8
Fix code style
cardoso d74cf48
Merge branch 'develop' into imp/broadcast_permissions
cardoso 47410cb
Merge branch 'develop' into imp/broadcast_permissions
cardoso 9d01a6b
Merge branch 'develop' into imp/broadcast_permissions
cardoso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,8 @@ Meteor.startup(function() { | |
{ _id: 'view-statistics', roles : ['admin'] }, | ||
{ _id: 'view-user-administration', roles : ['admin'] }, | ||
{ _id: 'preview-c-room', roles : ['admin', 'user', 'anonymous'] }, | ||
{ _id: 'view-outside-room', roles : ['admin', 'owner', 'moderator', 'user'] } | ||
{ _id: 'view-outside-room', roles : ['admin', 'owner', 'moderator', 'user'] }, | ||
{ _id: 'view-broadcast-member-list', roles : ['admin', 'owner', 'moderator'] } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also repeating many times the roles here and the name of the permissions. |
||
]; | ||
|
||
for (const permission of permissions) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,7 @@ RocketChat.TabBar.addButton({ | |
return true; | ||
} | ||
|
||
return RocketChat.authz.hasRole(Meteor.userId(), ['admin', 'moderator', 'owner'], rid); | ||
return RocketChat.authz.hasAllPermission('view-broadcast-member-list', rid); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌 |
||
} | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use a "constant" on the name of the permission? Looks like we're repeating it many times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have to do that for all other permissions too.
But there wouldn't be much benefit with this being Javascript anyway. ¯\_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main benefit would be not repeating yourself :-)