Skip to content

Commit

Permalink
Disallow peer reviewers from printing results (MarkUsProject#7114)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-yz-liu authored and Donny Wong committed Jun 10, 2024
1 parent 9989898 commit d68a3de
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [v2.4.11]

### 🚨 Breaking changes

- Disallow peer reviewers from printing results (#7114)

## [v2.4.10]

### ✨ New features and improvements
Expand Down
24 changes: 13 additions & 11 deletions app/assets/javascripts/Components/Result/submission_selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,19 @@ export class SubmissionSelector extends React.Component {
}

renderPrintButton() {
return (
<a
className={"button"}
href={Routes.print_course_result_path(this.props.course_id, this.props.result_id)}
style={{alignSelf: "flex-end"}}
title={I18n.t("results.print")}
>
<FontAwesomeIcon icon={"fa-solid fa-print"} />
<span className="button-text">{I18n.t("results.print")}</span>
</a>
);
if (!this.props.is_reviewer) {
return (
<a
className={"button"}
href={Routes.print_course_result_path(this.props.course_id, this.props.result_id)}
style={{alignSelf: "flex-end"}}
title={I18n.t("results.print")}
>
<FontAwesomeIcon icon={"fa-solid fa-print"} />
<span className="button-text">{I18n.t("results.print")}</span>
</a>
);
}
}

onOpenFilterModal = () => {
Expand Down
4 changes: 2 additions & 2 deletions app/policies/result_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
class ResultPolicy < ApplicationPolicy
default_rule :manage?
alias_rule :get_test_runs_instructors_released?, to: :view_marks?
alias_rule :create?, :add_extra_mark?, :remove_extra_mark?, :get_test_runs_instructors?,
alias_rule :create?, :add_extra_mark?, :remove_extra_mark?, :get_test_runs_instructors?, :print?,
:add_tag?, :remove_tag?, :revert_to_automatic_deductions?, :random_incomplete_submission?, to: :grade?
alias_rule :show?, :get_annotations?, :print?, to: :view?
alias_rule :show?, :get_annotations?, to: :view?
alias_rule :edit?, :toggle_marking_state?, :update_overall_comment?, :next_grouping?, to: :review?
alias_rule :refresh_view_tokens?, :update_view_token_expiry?, to: :set_released_to_students?

Expand Down

0 comments on commit d68a3de

Please sign in to comment.