EE: Add the ability to restrict the user roles that can send team invites (#3442)

Этот коммит содержится в:
Joram Wilander
2016-06-29 14:16:17 -04:00
коммит произвёл GitHub
родитель 4c9b48da8f
Коммит b97b3ae617
16 изменённых файлов: 259 добавлений и 48 удалений

Просмотреть файл

@@ -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 = (
<a
className='intro-links'
href='#'
@@ -108,6 +110,17 @@ export function createDefaultIntroMessage(channel) {
</a>
);
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 (
<div className='channel-intro'>
<FormattedHTMLMessage

Просмотреть файл

@@ -755,5 +755,8 @@ export default {
MAX_PREV_MSGS: 100,
POST_COLLAPSE_TIMEOUT: 1000 * 60 * 5, // five minutes
LICENSE_EXPIRY_NOTIFICATION: 1000 * 60 * 60 * 24 * 15, // 15 days
LICENSE_GRACE_PERIOD: 1000 * 60 * 60 * 24 * 15 // 15 days
LICENSE_GRACE_PERIOD: 1000 * 60 * 60 * 24 * 15, // 15 days
TEAM_INVITE_ALL: 'all',
TEAM_INVITE_TEAM_ADMIN: 'team_admin',
TEAM_INVITE_SYSTEM_ADMIN: 'system_admin'
};