Commit 387a03f9 authored by Matthieu Lamalle's avatar Matthieu Lamalle
Browse files

restrict servermodel edit config to root

parent 0ea86711
......@@ -31,11 +31,11 @@ class ServerModelDetail extends React.Component {
this.state = {
isLoading: false,
};
this.onAppClick = this.onAppClick.bind(this);
this.onAppClick = this.onAppClick.bind(this);
}
render(){
const { classes, inner, servermodel } = this.props;
const { classes, inner, servermodel, auth } = this.props;
const { isLoading } = this.state;
return (
<Page
......@@ -61,13 +61,15 @@ class ServerModelDetail extends React.Component {
<ListItem divider >
<ListItemText primary="Description" secondary={servermodel.model.servermodeldescription} />
</ListItem>
<ListItem divider
button
onClick={this.onAppClick}
>
<ListItemText primary="Configuration" secondary="Editer la configuration du modèle de serveur" />
<SettingsIcon />
</ListItem>
{ auth.user && auth.user.profil === "root" &&
<ListItem divider
button
onClick={this.onAppClick}
>
<ListItemText primary="Configuration" secondary="Editer la configuration du modèle de serveur" />
<SettingsIcon />
</ListItem>
}
</List>
</GridListTile>
......@@ -90,7 +92,7 @@ class ServerModelDetail extends React.Component {
);
}
onAppClick(app) {
onAppClick() {
const { servermodel } = this.props;
this.props.dispatch(appActions.openApp('ConfigEditor', {servermodel: servermodel.model}))
......@@ -131,11 +133,12 @@ const styles = theme => ({
});
function mapStateToProps({ servermodels }, { match }) {
function mapStateToProps({ servermodels, auth }, { match }) {
const servermodelId = parseInt(match.params.id, 10);
const servermodel = selectServermodelById(servermodels.describeById, servermodelId);
return {
servermodel,
auth
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment