summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-01-02 22:35:26 +0000
committerenahum <nahumhbl@gmail.com>2017-01-02 19:35:26 -0300
commite3b8511462552dddabe257ee16d74492fdaedb2c (patch)
tree2e9224295a5209a269dfa802daa313276a42b10e /webapp
parent267257b68055684f8bff94e4ae78d4b9e9c93b0b (diff)
downloadchat-e3b8511462552dddabe257ee16d74492fdaedb2c.tar.gz
chat-e3b8511462552dddabe257ee16d74492fdaedb2c.tar.bz2
chat-e3b8511462552dddabe257ee16d74492fdaedb2c.zip
PLT-4990 (WebApp): Separate channel management permissions. (#4865)
Diffstat (limited to 'webapp')
-rw-r--r--webapp/components/admin_console/policy_settings.jsx134
-rw-r--r--webapp/components/channel_header.jsx28
-rw-r--r--webapp/components/more_channels.jsx12
-rw-r--r--webapp/components/navbar.jsx28
-rw-r--r--webapp/components/new_channel_modal.jsx19
-rw-r--r--webapp/components/sidebar.jsx16
-rw-r--r--webapp/i18n/en.json19
-rw-r--r--webapp/utils/channel_utils.jsx70
8 files changed, 231 insertions, 95 deletions
diff --git a/webapp/components/admin_console/policy_settings.jsx b/webapp/components/admin_console/policy_settings.jsx
index 501e3724e..50b9d4033 100644
--- a/webapp/components/admin_console/policy_settings.jsx
+++ b/webapp/components/admin_console/policy_settings.jsx
@@ -23,8 +23,12 @@ export default class PolicySettings extends AdminSettings {
getConfigFromState(config) {
config.TeamSettings.RestrictTeamInvite = this.state.restrictTeamInvite;
+ config.TeamSettings.RestrictPublicChannelCreation = this.state.restrictPublicChannelCreation;
+ config.TeamSettings.RestrictPrivateChannelCreation = this.state.restrictPrivateChannelCreation;
config.TeamSettings.RestrictPublicChannelManagement = this.state.restrictPublicChannelManagement;
config.TeamSettings.RestrictPrivateChannelManagement = this.state.restrictPrivateChannelManagement;
+ config.TeamSettings.RestrictPublicChannelDeletion = this.state.restrictPublicChannelDeletion;
+ config.TeamSettings.RestrictPrivateChannelDeletion = this.state.restrictPrivateChannelDeletion;
return config;
}
@@ -32,8 +36,12 @@ export default class PolicySettings extends AdminSettings {
getStateFromConfig(config) {
return {
restrictTeamInvite: config.TeamSettings.RestrictTeamInvite,
+ restrictPublicChannelCreation: config.TeamSettings.RestrictPublicChannelCreation,
+ restrictPrivateChannelCreation: config.TeamSettings.RestrictPrivateChannelCreation,
restrictPublicChannelManagement: config.TeamSettings.RestrictPublicChannelManagement,
- restrictPrivateChannelManagement: config.TeamSettings.RestrictPrivateChannelManagement
+ restrictPrivateChannelManagement: config.TeamSettings.RestrictPrivateChannelManagement,
+ restrictPublicChannelDeletion: config.TeamSettings.RestrictPublicChannelDeletion,
+ restrictPrivateChannelDeletion: config.TeamSettings.RestrictPrivateChannelDeletion
};
}
@@ -74,7 +82,7 @@ export default class PolicySettings extends AdminSettings {
}
/>
<DropdownSetting
- id='restrictPublicChannelManagement'
+ id='restrictPublicChannelCreation'
values={[
{value: Constants.PERMISSIONS_ALL, text: Utils.localizeMessage('admin.general.policy.permissionsAll', 'All team members')},
{value: Constants.PERMISSIONS_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsAdmin', 'Team and System Admins')},
@@ -82,21 +90,75 @@ export default class PolicySettings extends AdminSettings {
]}
label={
<FormattedMessage
+ id='admin.general.policy.restrictPublicChannelCreationTitle'
+ defaultMessage='Enable public channel creation for:'
+ />
+ }
+ value={this.state.restrictPublicChannelCreation}
+ onChange={this.handleChange}
+ helpText={
+ <FormattedMessage
+ id='admin.general.policy.restrictPublicChannelCreationDescription'
+ defaultMessage='Set policy on who can create public channels.'
+ />
+ }
+ />
+ <DropdownSetting
+ id='restrictPublicChannelManagement'
+ values={[
+ {value: Constants.PERMISSIONS_ALL, text: Utils.localizeMessage('admin.general.policy.permissionsAllChannel', 'All channel members')},
+ {value: Constants.PERMISSIONS_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsAdmin', 'Team and System Admins')},
+ {value: Constants.PERMISSIONS_SYSTEM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsSystemAdmin', 'System Admins')}
+ ]}
+ label={
+ <FormattedMessage
id='admin.general.policy.restrictPublicChannelManagementTitle'
- defaultMessage='Enable public channel management permissions for:'
+ defaultMessage='Enable public channel renaming for:'
/>
}
value={this.state.restrictPublicChannelManagement}
onChange={this.handleChange}
helpText={
- <FormattedHTMLMessage
+ <FormattedMessage
id='admin.general.policy.restrictPublicChannelManagementDescription'
- defaultMessage='Set policy on who can create, delete, rename, and set the header or purpose for public channels.'
+ defaultMessage='Set policy on who can rename and set the header or purpose for public channels.'
/>
}
/>
<DropdownSetting
- id='restrictPrivateChannelManagement'
+ id='restrictPublicChannelDeletion'
+ values={[
+ {value: Constants.PERMISSIONS_ALL, text: Utils.localizeMessage('admin.general.policy.permissionsAllChannel', 'All channel members')},
+ {value: Constants.PERMISSIONS_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsAdmin', 'Team and System Admins')},
+ {value: Constants.PERMISSIONS_SYSTEM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsSystemAdmin', 'System Admins')}
+ ]}
+ label={
+ <FormattedMessage
+ id='admin.general.policy.restrictPublicChannelDeletionTitle'
+ defaultMessage='Enable public channel deletion for:'
+ />
+ }
+ value={this.state.restrictPublicChannelDeletion}
+ onChange={this.handleChange}
+ helpText={
+ <FormattedMessage
+ id='admin.general.policy.restrictPublicChannelDeletionDescription'
+ defaultMessage='Set policy on who can delete public channels. Deleted channels can be recovered from the database using a {commandLineToolLink}.'
+ values={{
+ commandLineToolLink: (
+ <a href='https://docs.mattermost.com/administration/command-line-tools.html'>
+ <FormattedMessage
+ id='admin.general.policy.restrictPublicChannelDeletionCommandLineToolLink'
+ defaultMessage='command line tool'
+ />
+ </a>
+ )
+ }}
+ />
+ }
+ />
+ <DropdownSetting
+ id='restrictPrivateChannelCreation'
values={[
{value: Constants.PERMISSIONS_ALL, text: Utils.localizeMessage('admin.general.policy.permissionsAll', 'All team members')},
{value: Constants.PERMISSIONS_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsAdmin', 'Team and System Admins')},
@@ -104,16 +166,70 @@ export default class PolicySettings extends AdminSettings {
]}
label={
<FormattedMessage
+ id='admin.general.policy.restrictPrivateChannelCreationTitle'
+ defaultMessage='Enable private group creation for:'
+ />
+ }
+ value={this.state.restrictPrivateChannelCreation}
+ onChange={this.handleChange}
+ helpText={
+ <FormattedMessage
+ id='admin.general.policy.restrictPrivateChannelCreationDescription'
+ defaultMessage='Set policy on who can create private groups.'
+ />
+ }
+ />
+ <DropdownSetting
+ id='restrictPrivateChannelManagement'
+ values={[
+ {value: Constants.PERMISSIONS_ALL, text: Utils.localizeMessage('admin.general.policy.permissionsAllChannel', 'All channel members')},
+ {value: Constants.PERMISSIONS_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsAdmin', 'Team and System Admins')},
+ {value: Constants.PERMISSIONS_SYSTEM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsSystemAdmin', 'System Admins')}
+ ]}
+ label={
+ <FormattedMessage
id='admin.general.policy.restrictPrivateChannelManagementTitle'
- defaultMessage='Enable private group management permissions for:'
+ defaultMessage='Enable private group renaming for:'
/>
}
value={this.state.restrictPrivateChannelManagement}
onChange={this.handleChange}
helpText={
- <FormattedHTMLMessage
+ <FormattedMessage
id='admin.general.policy.restrictPrivateChannelManagementDescription'
- defaultMessage='Set policy on who can create, delete, rename, and set the header or purpose for private groups.'
+ defaultMessage='Set policy on who can rename and set the header or purpose for private groups.'
+ />
+ }
+ />
+ <DropdownSetting
+ id='restrictPrivateChannelDeletion'
+ values={[
+ {value: Constants.PERMISSIONS_ALL, text: Utils.localizeMessage('admin.general.policy.permissionsAllChannel', 'All channel members')},
+ {value: Constants.PERMISSIONS_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsAdmin', 'Team and System Admins')},
+ {value: Constants.PERMISSIONS_SYSTEM_ADMIN, text: Utils.localizeMessage('admin.general.policy.permissionsSystemAdmin', 'System Admins')}
+ ]}
+ label={
+ <FormattedMessage
+ id='admin.general.policy.restrictPrivateChannelDeletionTitle'
+ defaultMessage='Enable private group deletion for:'
+ />
+ }
+ value={this.state.restrictPrivateChannelDeletion}
+ onChange={this.handleChange}
+ helpText={
+ <FormattedMessage
+ id='admin.general.policy.restrictPrivateChannelDeletionDescription'
+ defaultMessage='Set policy on who can delete private groups. Deleted groups can be recovered from the database using a {commandLineToolLink}.'
+ values={{
+ commandLineToolLink: (
+ <a href='https://docs.mattermost.com/administration/command-line-tools.html'>
+ <FormattedMessage
+ id='admin.general.policy.restrictPrivateChannelDeletionCommandLineToolLink'
+ defaultMessage='command line tool'
+ />
+ </a>
+ )
+ }}
/>
}
/>
diff --git a/webapp/components/channel_header.jsx b/webapp/components/channel_header.jsx
index 52bed85cd..555b539cd 100644
--- a/webapp/components/channel_header.jsx
+++ b/webapp/components/channel_header.jsx
@@ -206,30 +206,6 @@ export default class ChannelHeader extends React.Component {
});
}
- showManagementOptions(channel, isAdmin, isSystemAdmin) {
- if (global.window.mm_license.IsLicensed !== 'true') {
- return true;
- }
-
- if (channel.type === Constants.OPEN_CHANNEL) {
- if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
- return false;
- }
- if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
- return false;
- }
- } else if (channel.type === Constants.PRIVATE_CHANNEL) {
- if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
- return false;
- }
- if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
- return false;
- }
- }
-
- return true;
- }
-
initWebrtc(contactId, isOnline) {
if (isOnline && !this.state.isBusy) {
GlobalActions.emitCloseRightHandSide();
@@ -521,7 +497,7 @@ export default class ChannelHeader extends React.Component {
</li>
);
- if (this.showManagementOptions(channel, isAdmin, isSystemAdmin)) {
+ if (ChannelUtils.showManagementOptions(channel, isAdmin, isSystemAdmin)) {
dropdownContents.push(
<li
key='set_channel_header'
@@ -584,7 +560,9 @@ export default class ChannelHeader extends React.Component {
</a>
</li>
);
+ }
+ if (ChannelUtils.showDeleteOption(channel, isAdmin, isSystemAdmin)) {
if (!ChannelStore.isDefault(channel)) {
dropdownContents.push(deleteOption);
}
diff --git a/webapp/components/more_channels.jsx b/webapp/components/more_channels.jsx
index b0064f18a..5374c3344 100644
--- a/webapp/components/more_channels.jsx
+++ b/webapp/components/more_channels.jsx
@@ -9,6 +9,7 @@ import TeamStore from 'stores/team_store.jsx';
import Constants from 'utils/constants.jsx';
import * as AsyncClient from 'utils/async_client.jsx';
+import * as ChannelUtils from 'utils/channel_utils.jsx';
import {joinChannel, searchMoreChannels} from 'actions/channel_actions.jsx';
import React from 'react';
@@ -151,14 +152,9 @@ export default class MoreChannels extends React.Component {
const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser();
const isSystemAdmin = UserStore.isSystemAdminForCurrentUser();
- if (global.window.mm_license.IsLicensed === 'true') {
- if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
- createNewChannelButton = null;
- createChannelHelpText = null;
- } else if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
- createNewChannelButton = null;
- createChannelHelpText = null;
- }
+ if (!ChannelUtils.showCreateOption(Constants.OPEN_CHANNEL, isAdmin, isSystemAdmin)) {
+ createNewChannelButton = null;
+ createChannelHelpText = null;
}
return (
diff --git a/webapp/components/navbar.jsx b/webapp/components/navbar.jsx
index 07049446d..338d4edd1 100644
--- a/webapp/components/navbar.jsx
+++ b/webapp/components/navbar.jsx
@@ -222,30 +222,6 @@ export default class Navbar extends React.Component {
});
}
- showManagementOptions(channel, isAdmin, isSystemAdmin) {
- if (global.window.mm_license.IsLicensed !== 'true') {
- return true;
- }
-
- if (channel.type === Constants.OPEN_CHANNEL) {
- if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
- return false;
- }
- if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
- return false;
- }
- } else if (channel.type === Constants.PRIVATE_CHANNEL) {
- if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
- return false;
- }
- if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
- return false;
- }
- }
-
- return true;
- }
-
toggleFavorite = (e) => {
e.preventDefault();
@@ -388,7 +364,7 @@ export default class Navbar extends React.Component {
</li>
);
- if (this.showManagementOptions(channel, isAdmin, isSystemAdmin)) {
+ if (ChannelUtils.showManagementOptions(channel, isAdmin, isSystemAdmin)) {
setChannelHeaderOption = (
<li role='presentation'>
<a
@@ -444,7 +420,7 @@ export default class Navbar extends React.Component {
);
}
- if (this.showManagementOptions(channel, isAdmin, isSystemAdmin) || this.state.userCount === 1) {
+ if (ChannelUtils.showDeleteOption(channel, isAdmin, isSystemAdmin) || this.state.userCount === 1) {
if (!ChannelStore.isDefault(channel)) {
deleteChannelOption = (
<li role='presentation'>
diff --git a/webapp/components/new_channel_modal.jsx b/webapp/components/new_channel_modal.jsx
index 2a7d93b0c..fc9fd0295 100644
--- a/webapp/components/new_channel_modal.jsx
+++ b/webapp/components/new_channel_modal.jsx
@@ -6,6 +6,7 @@ import ReactDOM from 'react-dom';
import * as UserAgent from 'utils/user_agent.jsx';
import * as Utils from 'utils/utils.jsx';
+import * as ChannelUtils from 'utils/channel_utils.jsx';
import Constants from 'utils/constants.jsx';
import UserStore from 'stores/user_store.jsx';
@@ -141,18 +142,12 @@ export default class NewChannelModal extends React.Component {
const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser();
const isSystemAdmin = UserStore.isSystemAdminForCurrentUser();
- if (global.window.mm_license.IsLicensed === 'true') {
- if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
- createPublicChannelLink = null;
- } else if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
- createPublicChannelLink = null;
- }
-
- if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
- createPrivateChannelLink = null;
- } else if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
- createPrivateChannelLink = null;
- }
+ if (!ChannelUtils.showCreateOption(Constants.OPEN_CHANNEL, isAdmin, isSystemAdmin)) {
+ createPublicChannelLink = null;
+ }
+
+ if (!ChannelUtils.showCreateOption(Constants.PRIVATE_CHANNEL, isAdmin, isSystemAdmin)) {
+ createPrivateChannelLink = null;
}
var channelTerm = '';
diff --git a/webapp/components/sidebar.jsx b/webapp/components/sidebar.jsx
index 0651ebeee..1b802b1b0 100644
--- a/webapp/components/sidebar.jsx
+++ b/webapp/components/sidebar.jsx
@@ -722,18 +722,12 @@ export default class Sidebar extends React.Component {
</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 (!ChannelUtils.showCreateOption(Constants.OPEN_CHANNEL, isAdmin, isSystemAdmin)) {
+ 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;
- }
+ if (!ChannelUtils.showCreateOption(Constants.PRIVATE_CHANNEL, isAdmin, isSystemAdmin)) {
+ createPrivateChannelIcon = null;
}
let moreDirectChannelsModal;
diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json
index 641c8daa8..55727c115 100644
--- a/webapp/i18n/en.json
+++ b/webapp/i18n/en.json
@@ -310,11 +310,22 @@
"admin.general.policy": "Policy",
"admin.general.policy.permissionsAdmin": "Team and System Admins",
"admin.general.policy.permissionsAll": "All team members",
+ "admin.general.policy.permissionsAllChannel": "All channel members",
"admin.general.policy.permissionsSystemAdmin": "System Admins",
- "admin.general.policy.restrictPrivateChannelManagementDescription": "Set policy on who can create, delete, rename, and set the header or purpose for private groups.",
- "admin.general.policy.restrictPrivateChannelManagementTitle": "Enable private group management permissions for:",
- "admin.general.policy.restrictPublicChannelManagementDescription": "Set policy on who can create, delete, rename, and set the header or purpose for public channels.",
- "admin.general.policy.restrictPublicChannelManagementTitle": "Enable public channel management permissions for:",
+ "admin.general.policy.restrictPublicChannelCreationTitle": "Enable public channel creation for:",
+ "admin.general.policy.restrictPublicChannelCreationDescription": "Set policy on who can create public channels.",
+ "admin.general.policy.restrictPublicChannelManagementTitle": "Enable public channel renaming for:",
+ "admin.general.policy.restrictPublicChannelManagementDescription": "Set policy on who can rename and set the header or purpose for public channels.",
+ "admin.general.policy.restrictPublicChannelDeletionTitle": "Enable public channel deletion for:",
+ "admin.general.policy.restrictPublicChannelDeletionDescription": "Set policy on who can delete public channels. Deleted channels can be recovered from the database using a {commandLineToolLink}.",
+ "admin.general.policy.restrictPublicChannelDeletionCommandLineToolLink": "command line tool",
+ "admin.general.policy.restrictPrivateChannelCreationTitle": "Enable private group creation for:",
+ "admin.general.policy.restrictPrivateChannelCreationDescription": "Set policy on who can create private groups.",
+ "admin.general.policy.restrictPrivateChannelManagementTitle": "Enable private group renaming for:",
+ "admin.general.policy.restrictPrivateChannelManagementDescription": "Set policy on who can rename and set the header or purpose for private groups.",
+ "admin.general.policy.restrictPrivateChannelDeletionTitle": "Enable private group deletion for:",
+ "admin.general.policy.restrictPrivateChannelDeletionDescription": "Set policy on who can delete private groups. Deleted groups can be recovered from the database using a {commandLineToolLink}.",
+ "admin.general.policy.restrictPrivateChannelDeletionCommandLineToolLink": "command line tool",
"admin.general.policy.teamInviteDescription": "Set policy on who can invite others to a team using <b>Invite New Member</b> to invite new users by email, or the <b>Get Team Invite Link</b> options from the Main Menu. If <b>Get Team Invite Link</b> is used to share a link, you can expire the invite code from <b>Team Settings</b> > <b>Invite Code</b> after the desired users join the team.",
"admin.general.policy.teamInviteTitle": "Enable sending team invites from:",
"admin.general.privacy": "Privacy",
diff --git a/webapp/utils/channel_utils.jsx b/webapp/utils/channel_utils.jsx
index 113d86ea8..50573e077 100644
--- a/webapp/utils/channel_utils.jsx
+++ b/webapp/utils/channel_utils.jsx
@@ -82,6 +82,76 @@ export function sortChannelsByDisplayName(a, b) {
return buildDisplayNameAndTypeComparable(a).localeCompare(buildDisplayNameAndTypeComparable(b), locale, {numeric: true});
}
+export function showCreateOption(channelType, isAdmin, isSystemAdmin) {
+ if (global.window.mm_license.IsLicensed !== 'true') {
+ return true;
+ }
+
+ if (channelType === Constants.OPEN_CHANNEL) {
+ if (global.window.mm_config.RestrictPublicChannelCreation === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ return false;
+ } else if (global.window.mm_config.RestrictPublicChannelCreation === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ return false;
+ }
+ } else if (channelType === Constants.PRIVATE_CHANNEL) {
+ if (global.window.mm_config.RestrictPrivateChannelCreation === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ return false;
+ } else if (global.window.mm_config.RestrictPrivateChannelCreation === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+export function showManagementOptions(channel, isAdmin, isSystemAdmin) {
+ if (global.window.mm_license.IsLicensed !== 'true') {
+ return true;
+ }
+
+ if (channel.type === Constants.OPEN_CHANNEL) {
+ if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ return false;
+ }
+ if (global.window.mm_config.RestrictPublicChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ return false;
+ }
+ } else if (channel.type === Constants.PRIVATE_CHANNEL) {
+ if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ return false;
+ }
+ if (global.window.mm_config.RestrictPrivateChannelManagement === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+export function showDeleteOption(channel, isAdmin, isSystemAdmin) {
+ if (global.window.mm_license.IsLicensed !== 'true') {
+ return true;
+ }
+
+ if (channel.type === Constants.OPEN_CHANNEL) {
+ if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ return false;
+ }
+ if (global.window.mm_config.RestrictPublicChannelDeletion === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ return false;
+ }
+ } else if (channel.type === Constants.PRIVATE_CHANNEL) {
+ if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_SYSTEM_ADMIN && !isSystemAdmin) {
+ return false;
+ }
+ if (global.window.mm_config.RestrictPrivateChannelDeletion === Constants.PERMISSIONS_TEAM_ADMIN && !isAdmin) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
/*
* not exported helpers
*/