Manuel Bustillo 134bf27955
All checks were successful
Add copyright notice / copyright_notice (pull_request) Successful in 1m13s
Check usage of free licenses / check-licenses (pull_request) Successful in 2m4s
Run unit tests / unit_tests (pull_request) Successful in 2m34s
Add copyright notice
2024-11-18 23:27:50 +00:00

19 lines
412 B
Ruby

# Copyright (C) 2024 Manuel Bustillo
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
set_current_user || reject_unauthorized_connection
end
private
def set_current_user
if session = Session.find_by(id: cookies.signed[:session_id])
self.current_user = session.user
end
end
end
end