Further check for programming group and add custom logging

Fixes CODEOCEAN-V2
This commit is contained in:
Sebastian Serth
2023-09-22 16:48:43 +02:00
parent 40aa50f772
commit 47dd4cf4f7
2 changed files with 3 additions and 1 deletions

View File

@ -31,6 +31,8 @@ class SynchronizedEditorChannel < ApplicationCable::Channel
def specific_channel
reject unless ProgrammingGroupPolicy.new(current_user, programming_group).stream_sync_editor?
"synchronized_editor_channel_group_#{programming_group.id}"
rescue NoMethodError => e
Sentry.capture_exception(e, extras: {current_user:, programming_group:, session_id: @session_id, identifier: @identifier})
end
def programming_group

View File

@ -11,7 +11,7 @@ class ProgrammingGroupPolicy < ApplicationPolicy
def stream_sync_editor?
# A programming group needs to exist for the user to be able to stream the synchronized editor.
return false unless @record
return false if @record.blank?
admin? || author_in_programming_group?
end