feat: Permissions for board members

Closes #262
This commit is contained in:
Maksim Eltyshev
2022-08-19 14:00:40 +02:00
parent d80a538857
commit 51fa7df69c
61 changed files with 1063 additions and 191 deletions

View File

@@ -3,6 +3,7 @@ import { connect } from 'react-redux';
import selectors from '../selectors';
import entryActions from '../entry-actions';
import { BoardMembershipRoles } from '../constants/Enums';
import List from '../components/List';
const makeMapStateToProps = () => {
@@ -12,7 +13,7 @@ const makeMapStateToProps = () => {
return (state, { id, index }) => {
const { name, isPersisted } = selectListById(state, id);
const cardIds = selectCardIdsByListId(state, id);
const isCurrentUserMember = selectors.selectIsCurrentUserMemberForCurrentBoard(state);
const currentUserMembership = selectors.selectCurrentUserMembershipForCurrentBoard(state);
return {
id,
@@ -20,7 +21,8 @@ const makeMapStateToProps = () => {
name,
isPersisted,
cardIds,
canEdit: isCurrentUserMember,
canEdit:
!!currentUserMembership && currentUserMembership.role === BoardMembershipRoles.EDITOR,
};
};
};