1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: Project actions need to checkAccess based on projectId

This commit is contained in:
Ivar Conradi Østhus 2021-05-25 19:08:57 +02:00
parent 5bbd0a734b
commit cf1cae9b84
2 changed files with 8 additions and 4 deletions

View File

@ -98,7 +98,7 @@ const ProjectList = ({ projects, fetchProjects, removeProject, history }) => {
const renderProjectList = () =>
projects.map(project => (
<ListItem key={project.name} classes={{ root: styles.listItem }}>
<ListItem key={project.id} classes={{ root: styles.listItem }}>
<ListItemAvatar>
<Icon>folder_open</Icon>
</ListItemAvatar>
@ -107,11 +107,11 @@ const ProjectList = ({ projects, fetchProjects, removeProject, history }) => {
secondary={project.description}
/>
<ConditionallyRender
condition={hasAccess(UPDATE_PROJECT, project.name)}
condition={hasAccess(UPDATE_PROJECT, project.id)}
show={mgmAccessButton(project)}
/>
<ConditionallyRender
condition={hasAccess(DELETE_PROJECT, project.name)}
condition={hasAccess(DELETE_PROJECT, project.id)}
show={deleteProjectButton(project)}
/>
</ListItem>

View File

@ -1,6 +1,7 @@
import { connect } from 'react-redux';
import ProjectComponent from './form-project-component';
import { createProject, validateId } from './../../store/project/actions';
import { fetchUser } from './../../store/user/actions';
const mapStateToProps = () => ({
project: { id: '', name: '', description: '' },
@ -8,7 +9,10 @@ const mapStateToProps = () => ({
const mapDispatchToProps = dispatch => ({
validateId,
submit: project => createProject(project)(dispatch),
submit: async project => {
await createProject(project)(dispatch);
fetchUser()(dispatch);
},
editMode: false,
});