fix saving to gallery and only allow admins

This commit is contained in:
Mario Pesch 2023-05-11 12:15:55 +02:00
parent a969727a48
commit d3cac65b97
3 changed files with 3 additions and 3 deletions

View File

@ -153,7 +153,7 @@ class ProjectHome extends Component {
</Typography>
</Link>
{this.props.user &&
this.props.user.email === project.creator ? (
(this.props.user.email === project.creator || this.props.user.role === 'admin') ? (
<div>
<Divider
style={{

View File

@ -132,7 +132,7 @@ class SaveProject extends Component {
<Tooltip title={this.state.projectType === 'project' ? Blockly.Msg.tooltip_update_project : Blockly.Msg.tooltip_save_project} arrow>
<IconButton
className={this.props.classes.button}
onClick={this.props.user.blocklyRole !== 'user' && (!this.props.project || this.props.user.email === this.props.project.creator) ? (e) => this.toggleMenu(e) : this.state.projectType === 'project' ? () => this.props.updateProject(this.state.projectType, this.props.project._id) : () => { this.setState({ projectType: 'project' }, () => this.saveProject()) }}
onClick={this.props.user.blocklyRole === 'admin' && (!this.props.project || this.props.user.email === this.props.project.creator) ? (e) => this.toggleMenu(e) : this.state.projectType === 'project' ? () => this.props.updateProject(this.state.projectType, this.props.project._id) : () => { this.setState({ projectType: 'project' }, () => this.saveProject()) }}
size="large">
<FontAwesomeIcon icon={faSave} size="xs" />
</IconButton>

View File

@ -86,7 +86,7 @@ class WorkspaceFunc extends Component {
(this.props.projectType === "project" ||
this.props.projectType === "gallery") &&
this.props.user &&
this.props.user.email === this.props.project.creator ? (
(this.props.user.email === this.props.project.creator || this.props.user.role === 'admin' ) ? (
<DeleteProject
project={this.props.project}
projectType={this.props.projectType}