Adjust teacher permissions:
* Hide non-public exercises and proxy exercises * Hide average working time value on statistic page * Add hint about filter to submission page for teachers * Hide display name from feedback page
This commit is contained in:
@ -4,7 +4,7 @@ class ExercisePolicy < AdminOrAuthorPolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
[:show?, :feedback?, :requests_for_comments?, :statistics?].each do |action|
|
[:show?, :feedback?, :requests_for_comments?, :statistics?].each do |action|
|
||||||
define_method(action) { admin? || teacher? }
|
define_method(action) { admin? || teacher_in_study_group? || teacher? && @record.public? || author? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def study_group_dashboard?
|
def study_group_dashboard?
|
||||||
|
@ -4,7 +4,7 @@ class ProxyExercisePolicy < AdminOrAuthorPolicy
|
|||||||
end
|
end
|
||||||
|
|
||||||
def show?
|
def show?
|
||||||
admin? || teacher?
|
admin? || teacher_in_study_group? || teacher? && @record.public? || author?
|
||||||
end
|
end
|
||||||
|
|
||||||
[:clone?, :destroy?, :edit?, :update?].each do |action|
|
[:clone?, :destroy?, :edit?, :update?].each do |action|
|
||||||
|
@ -79,6 +79,8 @@ h1 = "#{@exercise} (external user #{link_to_if(policy(@external_user).show?, @ex
|
|||||||
= t('.within_grace_period')
|
= t('.within_grace_period')
|
||||||
.col-sm-3.after_late_deadline.py-2
|
.col-sm-3.after_late_deadline.py-2
|
||||||
= t('.after_late_deadline')
|
= t('.after_late_deadline')
|
||||||
|
- unless current_user.try(:admin?)
|
||||||
|
p.mt-2 = t('.filter')
|
||||||
- if current_user.try(:admin?)
|
- if current_user.try(:admin?)
|
||||||
p = t('.addendum', delta: StatisticsHelper::WORKING_TIME_DELTA_IN_SECONDS / 60)
|
p = t('.addendum', delta: StatisticsHelper::WORKING_TIME_DELTA_IN_SECONDS / 60)
|
||||||
.d-none#wtimes data-working_times=ActiveSupport::JSON.encode(@working_times_until);
|
.d-none#wtimes data-working_times=ActiveSupport::JSON.encode(@working_times_until);
|
||||||
|
@ -18,7 +18,8 @@ h1 = link_to_if(policy(@exercise).show?, @exercise, exercise_path(@exercise))
|
|||||||
li.card.mt-2
|
li.card.mt-2
|
||||||
.card-header role="tab" id="heading"
|
.card-header role="tab" id="heading"
|
||||||
div.clearfix.feedback-header
|
div.clearfix.feedback-header
|
||||||
span.username = link_to(feedback.user.displayname, statistics_external_user_exercise_path(id: @exercise.id, external_user_id: feedback.user.id))
|
- if policy(@exercise).detailed_statistics?
|
||||||
|
span.username = link_to_if(policy(feedback.user).show?, feedback.user.displayname, statistics_external_user_exercise_path(id: @exercise.id, external_user_id: feedback.user.id))
|
||||||
- if feedback.anomaly_notification
|
- if feedback.anomaly_notification
|
||||||
i class="fa fa-envelope-o" data-placement="top" data-toggle="tooltip" data-container="body" title=feedback.anomaly_notification.reason
|
i class="fa fa-envelope-o" data-placement="top" data-toggle="tooltip" data-container="body" title=feedback.anomaly_notification.reason
|
||||||
span.date = feedback.created_at
|
span.date = feedback.created_at
|
||||||
|
@ -21,6 +21,7 @@ h1 = @exercise
|
|||||||
p == @exercise.average_score ? t('shared.out_of', maximum_value: @exercise.maximum_score, value: @exercise.average_score.round(2)) : empty
|
p == @exercise.average_score ? t('shared.out_of', maximum_value: @exercise.maximum_score, value: @exercise.average_score.round(2)) : empty
|
||||||
p = progress_bar(@exercise.average_percentage)
|
p = progress_bar(@exercise.average_percentage)
|
||||||
|
|
||||||
|
- if policy(@exercise).detailed_statistics?
|
||||||
= row(label: '.average_worktime') do
|
= row(label: '.average_worktime') do
|
||||||
p = @exercise.average_working_time
|
p = @exercise.average_working_time
|
||||||
|
|
||||||
|
@ -455,6 +455,7 @@ de:
|
|||||||
within_grace_period: Abgabe innerhalb der Gnadenfrist
|
within_grace_period: Abgabe innerhalb der Gnadenfrist
|
||||||
after_late_deadline: Verspätete Abgabe
|
after_late_deadline: Verspätete Abgabe
|
||||||
addendum: '* Differenzen von mehr als %{delta} Minuten werden ignoriert.'
|
addendum: '* Differenzen von mehr als %{delta} Minuten werden ignoriert.'
|
||||||
|
filter: "Hinweis: Nur die letzte Abgabe vor einer Abgabefrist ist sichtbar."
|
||||||
proxy_exercises:
|
proxy_exercises:
|
||||||
index:
|
index:
|
||||||
clone: Duplizieren
|
clone: Duplizieren
|
||||||
|
@ -455,6 +455,7 @@ en:
|
|||||||
within_grace_period: Within Grace Period
|
within_grace_period: Within Grace Period
|
||||||
after_late_deadline: Too Late
|
after_late_deadline: Too Late
|
||||||
addendum: "* Deltas longer than %{delta} minutes are ignored."
|
addendum: "* Deltas longer than %{delta} minutes are ignored."
|
||||||
|
filter: "Remember: Only the last submission per deadline is shown."
|
||||||
proxy_exercises:
|
proxy_exercises:
|
||||||
index:
|
index:
|
||||||
clone: Duplicate
|
clone: Duplicate
|
||||||
|
@ -3,7 +3,7 @@ require 'rails_helper'
|
|||||||
describe ExercisePolicy do
|
describe ExercisePolicy do
|
||||||
subject { described_class }
|
subject { described_class }
|
||||||
|
|
||||||
let(:exercise) { FactoryBot.build(:dummy) }
|
let(:exercise) { FactoryBot.build(:dummy, public: true) }
|
||||||
|
|
||||||
permissions :batch_update? do
|
permissions :batch_update? do
|
||||||
it 'grants access to admins only' do
|
it 'grants access to admins only' do
|
||||||
|
Reference in New Issue
Block a user