Skip to content

Commit

Permalink
Allow zeus to see activities in hidden courses even when not subscribed
Browse files Browse the repository at this point in the history
  • Loading branch information
jorg-vr committed Dec 9, 2024
1 parent 77cce24 commit 82afe03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/course.rb
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def open_for_user?(user)
end

def visible_for_user?(user)
visible_for_all? || (visible_for_institution? && institution == user&.institution) || user&.member_of?(self)
visible_for_all? || (visible_for_institution? && institution == user&.institution) || user&.member_of?(self) || user&.zeus?
end

def invalidate_subscribed_members_count_cache
Expand Down
10 changes: 10 additions & 0 deletions test/system/courses_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,14 @@ class CoursesTest < ApplicationSystemTestCase
# assert redirected to login page
assert_selector 'h1', text: 'Sign in'
end

test 'zeus should see activities in hidden courses' do
course = create :course, visibility: :hidden, series_count: 1, activities_per_series: 1

sign_in users(:zeus)
visit(course_path(:en, course.id))

# assert activity table is visible
assert_selector '.activity-table'
end
end

0 comments on commit 82afe03

Please sign in to comment.