X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=skyquake%2Fplugins%2Faccounts%2Fsrc%2Faccount%2FaccountsDashboard.jsx;h=afa9ab15bd0bf9286859b1793d59da3b3a6b408a;hb=refs%2Fchanges%2F79%2F5479%2F2;hp=c0e06807ae807bdcf45f0f03b3d8ddb26c050270;hpb=e29efc315df33d546237e270470916e26df391d6;p=osm%2FUI.git diff --git a/skyquake/plugins/accounts/src/account/accountsDashboard.jsx b/skyquake/plugins/accounts/src/account/accountsDashboard.jsx index c0e06807a..afa9ab15b 100644 --- a/skyquake/plugins/accounts/src/account/accountsDashboard.jsx +++ b/skyquake/plugins/accounts/src/account/accountsDashboard.jsx @@ -1,5 +1,5 @@ /* - * + * * Copyright 2016 RIFT.IO Inc * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,20 @@ import AppHeader from 'widgets/header/header.jsx'; import AccountStore from './accountStore.js'; import AccountSidebar from '../account_sidebar/accountSidebar.jsx'; import SkyquakeComponent from 'widgets/skyquake_container/skyquakeComponent.jsx'; +import {SkyquakeRBAC, isRBACValid} from 'widgets/skyquake_rbac/skyquakeRBAC.jsx'; +import ROLES from 'utils/roleConstants.js'; + +const PROJECT_ROLES = ROLES.PROJECT; +const PLATFORM = ROLES.PLATFORM; + +//Delete this line after testing is done +// PROJECT_ROLES.ACCOUNT_ADMIN = ''; import 'style/layout.scss'; class AccountsDashboard extends React.Component { constructor(props) { super(props); - this.Store = this.props.flux.stores.hasOwnProperty('AccountStore') ? this.props.flux.stores.AccountStore : this.props.flux.createStore(AccountStore); + this.Store = this.props.flux.stores.hasOwnProperty('AccountStore') ? this.props.flux.stores.AccountStore : this.props.flux.createStore(AccountStore, "AccountStore"); this.state = this.Store.getState(); } componentWillMount() { @@ -43,11 +51,12 @@ class AccountsDashboard extends React.Component { render() { let self = this; let html; + let READONLY = !isRBACValid(this.context.userProfile, [PROJECT_ROLES.ACCOUNT_ADMIN, PROJECT_ROLES.PROJECT_ADMIN]); html = (
- +
- { this.props.children ? React.cloneElement(this.props.children, {store: self.Store, ...self.state}) : 'Edit or Create New Accounts' + { this.props.children ? React.cloneElement(this.props.children, {readonly: READONLY, store: self.Store, ...self.state}) : 'Edit or Create New Accounts' }
@@ -56,7 +65,8 @@ class AccountsDashboard extends React.Component { } } AccountsDashboard.contextTypes = { - router: React.PropTypes.object + router: React.PropTypes.object, + userProfile: React.PropTypes.object }; export default SkyquakeComponent(AccountsDashboard);