summaryrefslogtreecommitdiffstats
path: root/webapp/components/sidebar.jsx
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-07-06 08:23:24 -0400
committerGitHub <noreply@github.com>2016-07-06 08:23:24 -0400
commit5f7cb8cfbf879aa0b0d43a7b7068688368fda9fc (patch)
tree555f578f1346d0b18448176ce1dc2a4771f16c6a /webapp/components/sidebar.jsx
parent19d452c74efb96f718079d5a268ca51a8983c4bd (diff)
downloadchat-5f7cb8cfbf879aa0b0d43a7b7068688368fda9fc.tar.gz
chat-5f7cb8cfbf879aa0b0d43a7b7068688368fda9fc.tar.bz2
chat-5f7cb8cfbf879aa0b0d43a7b7068688368fda9fc.zip
PLT-3346/PLT-3342/PLT-3360 EE: Add the ability to restrict channel management permissions (#3453)
* EE: Add the ability to restrict channel management permissions * Always allow last user in a channel to delete that channel
Diffstat (limited to 'webapp/components/sidebar.jsx')
-rw-r--r--webapp/components/sidebar.jsx77
1 files changed, 51 insertions, 26 deletions
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index 4f678274d..fdcae1dff 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -682,6 +682,55 @@ export default class Sidebar extends React.Component {
/>
);
+ const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser();
+ const isSystemAdmin = UserStore.isSystemAdminForCurrentUser();
+
+ let createPublicChannelIcon = (
+ <OverlayTrigger
+ delayShow={500}
+ placement='top'
+ overlay={createChannelTootlip}
+ >
+ <a
+ className='add-channel-btn'
+ href='#'
+ onClick={this.showNewChannelModal.bind(this, Constants.OPEN_CHANNEL)}
+ >
+ {'+'}
+ </a>
+ </OverlayTrigger>
+ );
+
+ let createPrivateChannelIcon = (
+ <OverlayTrigger
+ delayShow={500}
+ placement='top'
+ overlay={createGroupTootlip}
+ >
+ <a
+ className='add-channel-btn'
+ href='#'
+ onClick={this.showNewChannelModal.bind(this, Constants.PRIVATE_CHANNEL)}
+ >
+ {'+'}
+ </a>
+ </OverlayTrigger>
+ );
+
+ if (global.window.mm_license.IsLicensed === 'true') {
+ if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ createPublicChannelIcon = null;
+ } else if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ createPublicChannelIcon = null;
+ }
+
+ if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ createPrivateChannelIcon = null;
+ } else if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ createPrivateChannelIcon = null;
+ }
+ }
+
return (
<div
className='sidebar--left'
@@ -728,19 +777,7 @@ export default class Sidebar extends React.Component {
id='sidebar.channels'
defaultMessage='Channels'
/>
- <OverlayTrigger
- delayShow={500}
- placement='top'
- overlay={createChannelTootlip}
- >
- <a
- className='add-channel-btn'
- href='#'
- onClick={this.showNewChannelModal.bind(this, 'O')}
- >
- {'+'}
- </a>
- </OverlayTrigger>
+ {createPublicChannelIcon}
</h4>
</li>
{publicChannelItems}
@@ -765,19 +802,7 @@ export default class Sidebar extends React.Component {
id='sidebar.pg'
defaultMessage='Private Groups'
/>
- <OverlayTrigger
- delayShow={500}
- placement='top'
- overlay={createGroupTootlip}
- >
- <a
- className='add-channel-btn'
- href='#'
- onClick={this.showNewChannelModal.bind(this, 'P')}
- >
- {'+'}
- </a>
- </OverlayTrigger>
+ {createPrivateChannelIcon}
</h4>
</li>
{privateChannelItems}