forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
38 lines (32 loc) · 1.48 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import * as Actions from 'mattermost-redux/actions/integrations';
import {getOAuthApps} from 'mattermost-redux/selectors/entities/integrations';
import {haveISystemPermission} from 'mattermost-redux/selectors/entities/roles';
import {Permissions} from 'mattermost-redux/constants';
import {getConfig} from 'mattermost-redux/selectors/entities/general';
import InstalledOAuthApps from './installed_oauth_apps.jsx';
function mapStateToProps(state) {
const config = getConfig(state);
const enableOAuthServiceProvider = config.EnableOAuthServiceProvider === 'true';
const enableOnlyAdminIntegrations = config.EnableOnlyAdminIntegrations === 'true';
return {
canManageOauth: haveISystemPermission(state, {permission: Permissions.MANAGE_OAUTH}),
oauthApps: getOAuthApps(state),
regenOAuthAppSecretRequest: state.requests.integrations.updateOAuthApp,
enableOAuthServiceProvider,
enableOnlyAdminIntegrations
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
getOAuthApps: Actions.getOAuthApps,
regenOAuthAppSecret: Actions.regenOAuthAppSecret,
deleteOAuthApp: Actions.deleteOAuthApp
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(InstalledOAuthApps);