Skip to content

Commit

Permalink
Fixing permissions checks for shadow assignment points in results table.
Browse files Browse the repository at this point in the history
  • Loading branch information
krulis-martin committed Mar 12, 2022
1 parent 6367768 commit ff025c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions src/components/Groups/ResultsTable/ResultsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ class ResultsTable extends Component {
/*
* Shadow Assignments
*/
shadowAssignments.sort(compareShadowAssignments).forEach(shadowAssignment =>
shadowAssignments.sort(compareShadowAssignments).forEach(shadowAssignment => {
const isClickable = hasPermissions(shadowAssignment, 'createPoints', 'updatePoints', 'removePoints');
columns.push(
new SortableTableColumnDescriptor(
shadowAssignment.id,
Expand All @@ -355,12 +356,12 @@ class ResultsTable extends Component {
headerSuffix: shadowAssignment.maxPoints,
headerSuffixClassName: styles.maxPointsRow,
cellRenderer: shadowAssignmentCellRendererCreator(shadowAssignments, locale),
isClickable: true,
onClick: (userId, shadowId) => this.openDialogShadowAssignment(userId, shadowId),
isClickable,
onClick: isClickable ? (userId, shadowId) => this.openDialogShadowAssignment(userId, shadowId) : null,
}
)
)
);
);
});

/*
* Total points and optionally buttons
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const EditShadowAssignmentPointsForm = ({
/>

{onRemovePoints && (
<Button onClick={onRemovePoints} variant="danger" className="em-margin-left">
<Button onClick={onRemovePoints} variant="danger">
<DeleteIcon gapRight />
<FormattedMessage
id="app.editShadowAssignmentPointsForm.removePoints"
Expand Down

0 comments on commit ff025c2

Please sign in to comment.