From ff025c2e311dae793d881886443b04bfb0c2b5b9 Mon Sep 17 00:00:00 2001 From: Martin Krulis Date: Thu, 10 Mar 2022 00:24:38 +0100 Subject: [PATCH] Fixing permissions checks for shadow assignment points in results table. --- src/components/Groups/ResultsTable/ResultsTable.js | 11 ++++++----- .../EditShadowAssignmentPointsForm.js | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/Groups/ResultsTable/ResultsTable.js b/src/components/Groups/ResultsTable/ResultsTable.js index f393667fb..4f45a5ded 100644 --- a/src/components/Groups/ResultsTable/ResultsTable.js +++ b/src/components/Groups/ResultsTable/ResultsTable.js @@ -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, @@ -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 diff --git a/src/components/forms/EditShadowAssignmentPointsForm/EditShadowAssignmentPointsForm.js b/src/components/forms/EditShadowAssignmentPointsForm/EditShadowAssignmentPointsForm.js index 733a952dd..3ccbb241f 100644 --- a/src/components/forms/EditShadowAssignmentPointsForm/EditShadowAssignmentPointsForm.js +++ b/src/components/forms/EditShadowAssignmentPointsForm/EditShadowAssignmentPointsForm.js @@ -126,7 +126,7 @@ const EditShadowAssignmentPointsForm = ({ /> {onRemovePoints && ( -