From b97b3ae6179bc15ec23e0697b08cdcbdf53e4ffc Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 29 Jun 2016 14:16:17 -0400 Subject: EE: Add the ability to restrict the user roles that can send team invites (#3442) --- webapp/utils/channel_intro_messages.jsx | 15 ++++++++++++++- webapp/utils/constants.jsx | 5 ++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'webapp/utils') diff --git a/webapp/utils/channel_intro_messages.jsx b/webapp/utils/channel_intro_messages.jsx index c9dd30712..043894b7b 100644 --- a/webapp/utils/channel_intro_messages.jsx +++ b/webapp/utils/channel_intro_messages.jsx @@ -7,6 +7,8 @@ import EditChannelHeaderModal from 'components/edit_channel_header_modal.jsx'; import ToggleModalButton from 'components/toggle_modal_button.jsx'; import UserProfile from 'components/user_profile.jsx'; import ChannelStore from 'stores/channel_store.jsx'; +import UserStore from 'stores/user_store.jsx'; +import TeamStore from 'stores/team_store.jsx'; import Constants from 'utils/constants.jsx'; import * as GlobalActions from 'actions/global_actions.jsx'; import Client from 'utils/web_client.jsx'; @@ -94,7 +96,7 @@ export function createOffTopicIntroMessage(channel) { } export function createDefaultIntroMessage(channel) { - const inviteModalLink = ( + let inviteModalLink = ( ); + const isAdmin = TeamStore.isTeamAdminForCurrentTeam() || UserStore.isSystemAdminForCurrentUser(); + const isSystemAdmin = UserStore.isSystemAdminForCurrentUser(); + + if (global.window.mm_license.IsLicensed === 'true') { + if (global.window.mm_config.RestrictTeamInvite === Constants.TEAM_INVITE_SYSTEM_ADMIN && !isSystemAdmin) { + inviteModalLink = null; + } else if (global.window.mm_config.RestrictTeamInvite === Constants.TEAM_INVITE_TEAM_ADMIN && !isAdmin) { + inviteModalLink = null; + } + } + return (