diff options
author | George Goldberg <george@gberg.me> | 2017-02-24 01:15:10 +0000 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-02-23 20:15:10 -0500 |
commit | 8509c2f0b0893f8a7936a1943cc924db09bb62f4 (patch) | |
tree | 9b52c232fbc96fadaec26f0694ffc7e764651757 /webapp/utils/channel_utils.jsx | |
parent | bc9f3dfa240b2a197859de006baf2eceaafe0fcf (diff) | |
download | chat-8509c2f0b0893f8a7936a1943cc924db09bb62f4.tar.gz chat-8509c2f0b0893f8a7936a1943cc924db09bb62f4.tar.bz2 chat-8509c2f0b0893f8a7936a1943cc924db09bb62f4.zip |
PLT-5080 (WebApp): Channel Admin permission level. (#5047)
* PLT-5080 (WebApp): Channel Admin permission level.
For channel management and channel deletion.
* Fix some incorrect showing/hiding of options.
* Remove incorrect client calls that was overwriting my channel members.
Diffstat (limited to 'webapp/utils/channel_utils.jsx')
-rw-r--r-- | webapp/utils/channel_utils.jsx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/webapp/utils/channel_utils.jsx b/webapp/utils/channel_utils.jsx index 67dcfac67..22c428cb8 100644 --- a/webapp/utils/channel_utils.jsx +++ b/webapp/utils/channel_utils.jsx @@ -126,7 +126,7 @@ export function showCreateOption(channelType, isAdmin, isSystemAdmin) { return true; } -export function showManagementOptions(channel, isAdmin, isSystemAdmin) { +export function showManagementOptions(channel, isAdmin, isSystemAdmin, isChannelAdmin) { if (global.window.mm_license.IsLicensed !== 'true') { return true; } @@ -138,6 +138,9 @@ export function showManagementOptions(channel, isAdmin, isSystemAdmin) { if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) { return false; } + if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) { + return false; + } } else if (channel.type === Constants.PRIVATE_CHANNEL) { if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) { return false; @@ -145,12 +148,15 @@ export function showManagementOptions(channel, isAdmin, isSystemAdmin) { if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) { return false; } + if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) { + return false; + } } return true; } -export function showDeleteOption(channel, isAdmin, isSystemAdmin) { +export function showDeleteOption(channel, isAdmin, isSystemAdmin, isChannelAdmin) { if (global.window.mm_license.IsLicensed !== 'true') { return true; } @@ -162,6 +168,9 @@ export function showDeleteOption(channel, isAdmin, isSystemAdmin) { if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) { return false; } + if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) { + return false; + } } else if (channel.type === Constants.PRIVATE_CHANNEL) { if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) { return false; @@ -169,6 +178,9 @@ export function showDeleteOption(channel, isAdmin, isSystemAdmin) { if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) { return false; } + if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_CHANNEL_ADMIN && !isChannelAdmin && !isAdmin) { + return false; + } } return true; |