PLT-4007 Fix OAuth: Javascript error when team admin accesses the OAuth 2.0 menu (#3887)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
1326ab66a1
Коммит
db660bdf9c
@@ -40,6 +40,7 @@ export default class BackstageSidebar extends React.Component {
|
||||
|
||||
renderIntegrations() {
|
||||
const config = window.mm_config;
|
||||
const isSystemAdmin = Utils.isSystemAdmin(this.props.user.roles);
|
||||
if (config.EnableIncomingWebhooks !== 'true' &&
|
||||
config.EnableOutgoingWebhooks !== 'true' &&
|
||||
config.EnableCommands !== 'true' &&
|
||||
@@ -48,7 +49,7 @@ export default class BackstageSidebar extends React.Component {
|
||||
}
|
||||
|
||||
if (config.EnableOnlyAdminIntegrations !== 'false' &&
|
||||
!Utils.isSystemAdmin(this.props.user.roles) &&
|
||||
!isSystemAdmin &&
|
||||
!TeamStore.isTeamAdmin(this.props.user.id, this.props.team.id)) {
|
||||
return null;
|
||||
}
|
||||
@@ -99,7 +100,7 @@ export default class BackstageSidebar extends React.Component {
|
||||
}
|
||||
|
||||
let oauthApps = null;
|
||||
if (config.EnableOAuthServiceProvider === 'true') {
|
||||
if (config.EnableOAuthServiceProvider === 'true' && (isSystemAdmin || config.EnableOnlyAdminIntegrations !== 'true')) {
|
||||
oauthApps = (
|
||||
<BackstageSection
|
||||
name='oauth2-apps'
|
||||
|
||||
@@ -11,16 +11,20 @@ import OutgoingWebhookIcon from 'images/outgoing_webhook.jpg';
|
||||
import SlashCommandIcon from 'images/slash_command_icon.jpg';
|
||||
import OAuthIcon from 'images/oauth_icon.png';
|
||||
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
export default class Integrations extends React.Component {
|
||||
static get propTypes() {
|
||||
return {
|
||||
team: React.propTypes.object.isRequired
|
||||
team: React.propTypes.object.isRequired,
|
||||
user: React.PropTypes.object.isRequired
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
const options = [];
|
||||
const config = window.mm_config;
|
||||
const isSystemAdmin = Utils.isSystemAdmin(this.props.user.roles);
|
||||
|
||||
if (config.EnableIncomingWebhooks === 'true') {
|
||||
options.push(
|
||||
@@ -88,7 +92,7 @@ export default class Integrations extends React.Component {
|
||||
);
|
||||
}
|
||||
|
||||
if (config.EnableOAuthServiceProvider === 'true') {
|
||||
if (config.EnableOAuthServiceProvider === 'true' && (isSystemAdmin || config.EnableOnlyAdminIntegrations !== 'true')) {
|
||||
options.push(
|
||||
<IntegrationOption
|
||||
key='oauth2Apps'
|
||||
|
||||
@@ -205,7 +205,7 @@ export default class NavbarDropdown extends React.Component {
|
||||
config.EnableIncomingWebhooks === 'true' ||
|
||||
config.EnableOutgoingWebhooks === 'true' ||
|
||||
config.EnableCommands === 'true' ||
|
||||
config.EnableOAuthServiceProvider === 'true';
|
||||
(config.EnableOAuthServiceProvider === 'true' && (isSystemAdmin || config.EnableOnlyAdminIntegrations !== 'true'));
|
||||
if (integrationsEnabled && (isAdmin || config.EnableOnlyAdminIntegrations !== 'true')) {
|
||||
integrationsLink = (
|
||||
<li>
|
||||
|
||||
Ссылка в новой задаче
Block a user