diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-06-29 14:16:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-29 14:16:17 -0400 |
commit | b97b3ae6179bc15ec23e0697b08cdcbdf53e4ffc (patch) | |
tree | 8b0b4438a88c044e63eb3520224bdf6b85b5c74b /webapp/components | |
parent | 4c9b48da8f54bc9af83c7e987149be316f5c61f7 (diff) | |
download | chat-b97b3ae6179bc15ec23e0697b08cdcbdf53e4ffc.tar.gz chat-b97b3ae6179bc15ec23e0697b08cdcbdf53e4ffc.tar.bz2 chat-b97b3ae6179bc15ec23e0697b08cdcbdf53e4ffc.zip |
EE: Add the ability to restrict the user roles that can send team invites (#3442)
Diffstat (limited to 'webapp/components')
-rw-r--r-- | webapp/components/admin_console/admin_sidebar.jsx | 14 | ||||
-rw-r--r-- | webapp/components/admin_console/localization_settings.jsx | 13 | ||||
-rw-r--r-- | webapp/components/admin_console/policy_settings.jsx | 73 | ||||
-rw-r--r-- | webapp/components/navbar_dropdown.jsx | 10 | ||||
-rw-r--r-- | webapp/components/sidebar_right_menu.jsx | 10 | ||||
-rw-r--r-- | webapp/components/tutorial/tutorial_intro_screens.jsx | 67 |
6 files changed, 147 insertions, 40 deletions
diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx index cb98c8ab1..b045ec5f4 100644 --- a/webapp/components/admin_console/admin_sidebar.jsx +++ b/webapp/components/admin_console/admin_sidebar.jsx @@ -180,6 +180,7 @@ export default class AdminSidebar extends React.Component { let license = null; let audits = null; + let policy = null; if (window.mm_config.BuildEnterpriseReady === 'true') { if (window.mm_license.IsLicensed === 'true') { @@ -210,6 +211,18 @@ export default class AdminSidebar extends React.Component { /> ); } + + policy = ( + <AdminSidebarSection + name='policy' + title={ + <FormattedMessage + id='admin.sidebar.policy' + defaultMessage='Policy' + /> + } + /> + ); } license = ( @@ -328,6 +341,7 @@ export default class AdminSidebar extends React.Component { /> } /> + {policy} <AdminSidebarSection name='privacy' title={ diff --git a/webapp/components/admin_console/localization_settings.jsx b/webapp/components/admin_console/localization_settings.jsx index 67cf26fee..c837ac277 100644 --- a/webapp/components/admin_console/localization_settings.jsx +++ b/webapp/components/admin_console/localization_settings.jsx @@ -49,8 +49,8 @@ export default class LocalizationSettings extends AdminSettings { return ( <h3> <FormattedMessage - id='admin.general.title' - defaultMessage='General Settings' + id='admin.general.localization' + defaultMessage='Localization' /> </h3> ); @@ -58,14 +58,7 @@ export default class LocalizationSettings extends AdminSettings { renderSettings() { return ( - <SettingsGroup - header={ - <FormattedMessage - id='admin.general.localization' - defaultMessage='Localization' - /> - } - > + <SettingsGroup> <DropdownSetting id='defaultServerLocale' values={this.state.languages} diff --git a/webapp/components/admin_console/policy_settings.jsx b/webapp/components/admin_console/policy_settings.jsx new file mode 100644 index 000000000..7fe8e9460 --- /dev/null +++ b/webapp/components/admin_console/policy_settings.jsx @@ -0,0 +1,73 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; + +import AdminSettings from './admin_settings.jsx'; +import SettingsGroup from './settings_group.jsx'; +import DropdownSetting from './dropdown_setting.jsx'; + +import Constants from 'utils/constants.jsx'; +import * as Utils from 'utils/utils.jsx'; + +import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; + +export default class PolicySettings extends AdminSettings { + constructor(props) { + super(props); + + this.getConfigFromState = this.getConfigFromState.bind(this); + + this.renderSettings = this.renderSettings.bind(this); + + this.state = Object.assign(this.state, { + restrictTeamInvite: props.config.TeamSettings.RestrictTeamInvite + }); + } + + getConfigFromState(config) { + config.TeamSettings.RestrictTeamInvite = this.state.restrictTeamInvite; + + return config; + } + + renderTitle() { + return ( + <h3> + <FormattedMessage + id='admin.general.policy' + defaultMessage='Policy' + /> + </h3> + ); + } + + renderSettings() { + return ( + <SettingsGroup> + <DropdownSetting + id='restrictTeamInvite' + values={[ + {value: Constants.TEAM_INVITE_ALL, text: Utils.localizeMessage('admin.general.policy.teamInviteAll', 'All team members')}, + {value: Constants.TEAM_INVITE_TEAM_ADMIN, text: Utils.localizeMessage('admin.general.policy.teamInviteAdmin', 'Team and System Admins')}, + {value: Constants.TEAM_INVITE_SYSTEM_ADMIN, text: Utils.localizeMessage('admin.general.policy.teamInviteSystemAdmin', 'System Admins')} + ]} + label={ + <FormattedMessage + id='admin.general.policy.teamInviteTitle' + defaultMessage='Enable sending team invites from:' + /> + } + value={this.state.restrictTeamInvite} + onChange={this.handleChange} + helpText={ + <FormattedHTMLMessage + id='admin.general.policy.teamInviteDescription' + defaultMessage='Selecting "All team members" allows any team member to invite others using an email invitation or team invite link.<br/><br/>Selecting "Team and System Admins" hides the email invitation and team invite link in the Main Menu from users who are not Team or System Admins. Note: If "Get Team Invite Link" is used to share a link, it will need to be regenerated after the desired users joined the team.<br/><br/>Selecting "System Admins" hides the email invitation and team invite link in the Main Menu from users who are not System Admins. Note: If "Get Team Invite Link" is used to share a link, it will need to be regenerated after the desired users joined the team.' + /> + } + /> + </SettingsGroup> + ); + } +} diff --git a/webapp/components/navbar_dropdown.jsx b/webapp/components/navbar_dropdown.jsx index 9d6d7fb22..c3b646e52 100644 --- a/webapp/components/navbar_dropdown.jsx +++ b/webapp/components/navbar_dropdown.jsx @@ -119,6 +119,16 @@ export default class NavbarDropdown extends React.Component { </li> ); } + + if (global.window.mm_license.IsLicensed === 'true') { + if (global.window.mm_config.RestrictTeamInvite === Constants.TEAM_INVITE_SYSTEM_ADMIN && !isSystemAdmin) { + teamLink = null; + inviteLink = null; + } else if (global.window.mm_config.RestrictTeamInvite === Constants.TEAM_INVITE_TEAM_ADMIN && !isAdmin) { + teamLink = null; + inviteLink = null; + } + } } if (isAdmin) { diff --git a/webapp/components/sidebar_right_menu.jsx b/webapp/components/sidebar_right_menu.jsx index 622b80337..8cb8733d7 100644 --- a/webapp/components/sidebar_right_menu.jsx +++ b/webapp/components/sidebar_right_menu.jsx @@ -184,6 +184,16 @@ export default class SidebarRightMenu extends React.Component { </li> ); } + + if (global.window.mm_license.IsLicensed === 'true') { + if (global.window.mm_config.RestrictTeamInvite === Constants.TEAM_INVITE_SYSTEM_ADMIN && !isSystemAdmin) { + teamLink = null; + inviteLink = null; + } else if (global.window.mm_config.RestrictTeamInvite === Constants.TEAM_INVITE_TEAM_ADMIN && !isAdmin) { + teamLink = null; + inviteLink = null; + } + } } if (isAdmin) { diff --git a/webapp/components/tutorial/tutorial_intro_screens.jsx b/webapp/components/tutorial/tutorial_intro_screens.jsx index 3928b7f20..b0d831d96 100644 --- a/webapp/components/tutorial/tutorial_intro_screens.jsx +++ b/webapp/components/tutorial/tutorial_intro_screens.jsx @@ -106,32 +106,45 @@ export default class TutorialIntroScreens extends React.Component { createScreenThree() { const team = TeamStore.getCurrent(); let inviteModalLink; + let inviteText; - if (team.type === Constants.INVITE_TEAM) { - inviteModalLink = ( - <a - className='intro-links' - href='#' - onClick={GlobalActions.showInviteMemberModal} - > - <FormattedMessage - id='tutorial_intro.invite' - defaultMessage='Invite teammates' - /> - </a> - ); - } else { - inviteModalLink = ( - <a - className='intro-links' - href='#' - onClick={GlobalActions.showGetTeamInviteLinkModal} - > + if (global.window.mm_license.IsLicensed !== 'true' || global.window.mm_config.RestrictTeamInvite === Constants.TEAM_INVITE_ALL) { + if (team.type === Constants.INVITE_TEAM) { + inviteModalLink = ( + <a + className='intro-links' + href='#' + onClick={GlobalActions.showInviteMemberModal} + > + <FormattedMessage + id='tutorial_intro.invite' + defaultMessage='Invite teammates' + /> + </a> + ); + } else { + inviteModalLink = ( + <a + className='intro-links' + href='#' + onClick={GlobalActions.showGetTeamInviteLinkModal} + > + <FormattedMessage + id='tutorial_intro.teamInvite' + defaultMessage='Invite teammates' + /> + </a> + ); + } + + inviteText = ( + <p> + {inviteModalLink} <FormattedMessage - id='tutorial_intro.teamInvite' - defaultMessage='Invite teammates' + id='tutorial_intro.whenReady' + defaultMessage=' when you’re ready.' /> - </a> + </p> ); } @@ -170,13 +183,7 @@ export default class TutorialIntroScreens extends React.Component { defaultMessage='You’re all set' /> </h3> - <p> - {inviteModalLink} - <FormattedMessage - id='tutorial_intro.whenReady' - defaultMessage=' when you’re ready.' - /> - </p> + {inviteText} {supportInfo} <FormattedMessage id='tutorial_intro.end' |