Add ProgrammingGroup & ProgrammingGroupMembership
* User can create programming group with other users for exercise * Submission is shared in a group * Also adjust specs
This commit is contained in:

committed by
Sebastian Serth

parent
0234414bae
commit
319c3ab3b4
@ -49,6 +49,13 @@ class ApplicationPolicy
|
||||
end
|
||||
private :teacher_in_study_group?
|
||||
|
||||
def author_in_programming_group?
|
||||
return false unless @record.contributor.programming_group?
|
||||
|
||||
@record.contributor.users.include?(@user)
|
||||
end
|
||||
private :author_in_programming_group?
|
||||
|
||||
def initialize(user, record)
|
||||
@user = user
|
||||
@record = record
|
||||
|
11
app/policies/programming_group_policy.rb
Normal file
11
app/policies/programming_group_policy.rb
Normal file
@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class ProgrammingGroupPolicy < ApplicationPolicy
|
||||
def new?
|
||||
everyone
|
||||
end
|
||||
|
||||
def create?
|
||||
everyone
|
||||
end
|
||||
end
|
@ -9,7 +9,7 @@ class SubmissionPolicy < ApplicationPolicy
|
||||
# download_submission_file? is used in the live_streams_controller.rb
|
||||
%i[download? download_file? download_submission_file? run? score? show? statistics? stop? test?
|
||||
insights?].each do |action|
|
||||
define_method(action) { admin? || author? }
|
||||
define_method(action) { admin? || author? || author_in_programming_group? }
|
||||
end
|
||||
|
||||
def render_file?
|
||||
|
Reference in New Issue
Block a user