diff options
author | George Goldberg <george@gberg.me> | 2017-04-04 19:43:22 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-04-04 14:43:22 -0400 |
commit | 6bb65ef420fba17ec02e9b8005ca58bb60321cdc (patch) | |
tree | a7f07fd4ae05c92ed0f0fa5496277514e5d1c59e /webapp/utils/channel_utils.jsx | |
parent | 6bf080393d88534aa658ecaff32ae089bd304772 (diff) | |
download | chat-6bb65ef420fba17ec02e9b8005ca58bb60321cdc.tar.gz chat-6bb65ef420fba17ec02e9b8005ca58bb60321cdc.tar.bz2 chat-6bb65ef420fba17ec02e9b8005ca58bb60321cdc.zip |
PLT-6139 (WebApp): Manage Private Channel Members (#5947)
Honour the policy setting for add/remove members from private channels
in the WebApp UI.
Diffstat (limited to 'webapp/utils/channel_utils.jsx')
-rw-r--r-- | webapp/utils/channel_utils.jsx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/webapp/utils/channel_utils.jsx b/webapp/utils/channel_utils.jsx index d916ca254..2930e58b6 100644 --- a/webapp/utils/channel_utils.jsx +++ b/webapp/utils/channel_utils.jsx @@ -208,6 +208,26 @@ export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin return true; } +export function canManageMembers(channel, isSystemAdmin, isTeamAdmin, isChannelAdmin) { + if (global.window.mm_license.IsLicensed !== 'true') { + return true; + } + + if (channel.type === Constants.PRIVATE_CHANNEL) { + if (global.window.mm_config.RestrictPrivateChannelManageMembers === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) { + return false; + } + if (global.window.mm_config.RestrictPrivateChannelManageMembers === Constants.PERMISSIONS_TEAM_ADMIN && !isTeamAdmin && !isSystemAdmin) { + return false; + } + if (global.window.mm_config.RestrictPrivateChannelManageMembers === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isTeamAdmin && !isSystemAdmin) { + return false; + } + } + + return true; +} + export function buildGroupChannelName(channelId) { const profiles = UserStore.getProfileListInChannel(channelId, true); let displayName = ''; |