mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
hide user management section for non-admins
This commit is contained in:
parent
8fb0166059
commit
d218c1854d
3 changed files with 8 additions and 4 deletions
|
@ -33,7 +33,9 @@ class SidebarMenu extends Component {
|
|||
<li><Link to="/projects" activeClassName="active">Projects</Link></li>
|
||||
<li><Link to="/simulations" activeClassName="active">Simulations</Link></li>
|
||||
<li><Link to="/simulators" activeClassName="active">Simulators</Link></li>
|
||||
<li><Link to="/users" activeClassName="active">User Management</Link></li>
|
||||
{ this.props.currentRole === 'admin' ?
|
||||
<li><Link to="/users" activeClassName="active">User Management</Link></li> : ''
|
||||
}
|
||||
<li><Link to="/logout">Logout</Link></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -76,9 +76,11 @@ class App extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
let currentUser = UserStore.getState().currentUser;
|
||||
|
||||
return {
|
||||
simulations: SimulationStore.getState(),
|
||||
currentUser: UserStore.getState().currentUser,
|
||||
currentRole: currentUser? currentUser.role : '',
|
||||
token: UserStore.getState().token,
|
||||
|
||||
runningSimulators: simulators
|
||||
|
@ -183,7 +185,7 @@ class App extends Component {
|
|||
<NotificationSystem ref="notificationSystem" />
|
||||
|
||||
<Header />
|
||||
<SidebarMenu />
|
||||
<SidebarMenu currentRole={ this.state.currentRole }/>
|
||||
|
||||
<div className="app-content">
|
||||
{children}
|
||||
|
|
|
@ -46,7 +46,7 @@ class UsersDataManager extends RestDataManager {
|
|||
RestAPI.get(this.makeURL('/users/me'), token).then(response => {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'users/current-user',
|
||||
user: response
|
||||
user: response.user
|
||||
});
|
||||
}).catch(error => {
|
||||
AppDispatcher.dispatch({
|
||||
|
|
Loading…
Add table
Reference in a new issue