d41d50d52b
and some other de-tenant changes, including removing the controller tenanting concerns
24 lines
634 B
Ruby
24 lines
634 B
Ruby
module ApplicationCable
|
|
class Connection < ActionCable::Connection::Base
|
|
identified_by :current_user
|
|
|
|
def connect
|
|
super
|
|
set_current_user || reject_unauthorized_connection
|
|
end
|
|
|
|
private
|
|
def set_current_user
|
|
if session = find_session_by_cookie
|
|
# # TODO:PLANB: not sure how to fix this
|
|
# membership = session.identity.memberships.find_by!(tenant: current_tenant)
|
|
# self.current_user = membership.user if membership.user.active?
|
|
end
|
|
end
|
|
|
|
def find_session_by_cookie
|
|
Session.find_signed(cookies.signed[:session_token])
|
|
end
|
|
end
|
|
end
|