aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-05-11 12:24:44 +0200
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>2017-05-12 12:37:19 +0200
commit555c7dd62475cac4e96bfa9ffbed6dd523ea8ad1 (patch)
treeb1b807f9bfb8cdd8e5cd210ccb93e3202a0e3204 /server/sonar-web/src/main/js/apps
parent8b20d9b681313b7b6b9bf0071e9169995d434912 (diff)
downloadsonarqube-555c7dd62475cac4e96bfa9ffbed6dd523ea8ad1.tar.gz
sonarqube-555c7dd62475cac4e96bfa9ffbed6dd523ea8ad1.zip
SONAR-8822 Show the administration menu only to authorized users
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js10
1 files changed, 4 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js
index 82e5fb84797..1aebb594952 100644
--- a/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js
+++ b/server/sonar-web/src/main/js/apps/account/organizations/UserOrganizations.js
@@ -25,16 +25,15 @@ import { Link } from 'react-router';
import OrganizationsList from './OrganizationsList';
import { translate } from '../../../helpers/l10n';
import { fetchIfAnyoneCanCreateOrganizations, fetchMyOrganizations } from './actions';
-import { getMyOrganizations, getSettingValue, getCurrentUser } from '../../../store/rootReducer';
+import { getAppState, getMyOrganizations, getSettingValue } from '../../../store/rootReducer';
import type { Organization } from '../../../store/organizations/duck';
-import { isUserAdmin } from '../../../helpers/users';
class UserOrganizations extends React.PureComponent {
mounted: boolean;
props: {
anyoneCanCreate?: { value: string },
- currentUser: Object,
+ canAdmin: boolean,
children?: React.Element<*>,
organizations: Array<Organization>,
fetchIfAnyoneCanCreateOrganizations: () => Promise<*>,
@@ -65,8 +64,7 @@ class UserOrganizations extends React.PureComponent {
const anyoneCanCreate =
this.props.anyoneCanCreate != null && this.props.anyoneCanCreate.value === 'true';
- const canCreateOrganizations =
- !this.state.loading && (anyoneCanCreate || isUserAdmin(this.props.currentUser));
+ const canCreateOrganizations = !this.state.loading && (anyoneCanCreate || this.props.canAdmin);
return (
<div className="account-body account-container">
@@ -101,7 +99,7 @@ class UserOrganizations extends React.PureComponent {
const mapStateToProps = state => ({
anyoneCanCreate: getSettingValue(state, 'sonar.organizations.anyoneCanCreate'),
- currentUser: getCurrentUser(state),
+ canAdmin: getAppState(state).canAdmin,
organizations: getMyOrganizations(state)
});