Skip to content

Commit

Permalink
Fixing permission hints in assignment navigation links.
Browse files Browse the repository at this point in the history
  • Loading branch information
krulis-martin committed Dec 4, 2022
1 parent 643f605 commit 1d36bc4
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/pages/Assignment/Assignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ import {
isAssignmentSolversLoading,
getAssignmentSolverSelector,
} from '../../redux/selectors/solutions';
import {
loggedUserIsStudentOfSelector,
loggedUserIsObserverOfSelector,
loggedUserIsSupervisorOfSelector,
loggedUserIsAdminOfSelector,
} from '../../redux/selectors/usersGroups';
import { loggedUserIsStudentOfSelector } from '../../redux/selectors/usersGroups';

import Page from '../../components/layout/Page';
import { AssignmentNavigation } from '../../components/layout/Navigation';
Expand Down Expand Up @@ -97,9 +92,6 @@ class Assignment extends Component {
loggedInUserId,
init,
isStudentOf,
isObserverOf,
isSupervisorOf,
isAdminOf,
canSubmit,
runtimeEnvironments,
exerciseSync,
Expand All @@ -124,7 +116,10 @@ class Assignment extends Component {
canEdit={hasPermissions(assignment, 'update')}
canViewSolutions={hasPermissions(assignment, 'viewAssignmentSolutions')}
canViewExercise={
isObserverOf(assignment.groupId) || isSupervisorOf(assignment.groupId) || isAdminOf(assignment.groupId)
hasPermissions(
assignment,
'viewAssignmentSolutions'
) /* this is not the exact hint, but we do not have anything better now */
}
/>

Expand Down Expand Up @@ -266,9 +261,6 @@ Assignment.propTypes = {
}).isRequired,
}).isRequired,
isStudentOf: PropTypes.func.isRequired,
isObserverOf: PropTypes.func.isRequired,
isSupervisorOf: PropTypes.func.isRequired,
isAdminOf: PropTypes.func.isRequired,
assignment: PropTypes.object,
canSubmit: ImmutablePropTypes.map,
submitting: PropTypes.bool.isRequired,
Expand Down Expand Up @@ -301,9 +293,6 @@ export default connect(
userId,
loggedInUserId,
isStudentOf: loggedUserIsStudentOfSelector(state),
isObserverOf: loggedUserIsObserverOfSelector(state),
isSupervisorOf: loggedUserIsSupervisorOfSelector(state),
isAdminOf: loggedUserIsAdminOfSelector(state),
canSubmit: canSubmitSolution(assignmentId)(state),
solutions: getUserSolutionsSortedData(state)(userId || loggedInUserId, assignmentId),
fetchManyStatus: fetchManyUserSolutionsStatus(state)(userId || loggedInUserId, assignmentId),
Expand Down

0 comments on commit 1d36bc4

Please sign in to comment.