Sha256: 041be0126953175e66b77537bfc30ba3477e8cd909e191a370333a377869796c

Contents?: true

Size: 690 Bytes

Versions: 15

Compression:

Stored size: 690 Bytes

Contents

module Symphonia
  module ActionCable
    module Connection

      extend ActiveSupport::Concern

      included do
        identified_by :current_user

        def connect
          self.current_user = find_verified_user_or_guest
          logger.add_tags 'ActionCable', self.current_user.login unless self.current_user.nil?
        end

        protected

        def find_verified_user_or_guest
          if (credentials = request.cookie_jar['symphonia/user_credentials']).present?
            ::Symphonia::User.find_by_persistence_token(credentials.split(':')[0])
          else
            nil
          end
        end
      end

      module ClassMethods
      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
symphonia-3.2.2 lib/symphonia/action_cable/connection.rb
symphonia-3.2.1 lib/symphonia/action_cable/connection.rb
symphonia-3.1.5 lib/symphonia/action_cable/connection.rb
symphonia-3.1.4 lib/symphonia/action_cable/connection.rb
symphonia-3.1.3 lib/symphonia/action_cable/connection.rb
symphonia-3.1.2 lib/symphonia/action_cable/connection.rb
symphonia-3.1.1 lib/symphonia/action_cable/connection.rb
symphonia-3.1.0 lib/symphonia/action_cable/connection.rb
symphonia-3.0.3 lib/symphonia/action_cable/connection.rb
symphonia-3.0.2 lib/symphonia/action_cable/connection.rb
symphonia-2.2.1 lib/symphonia/action_cable/connection.rb
symphonia-3.0.1 lib/symphonia/action_cable/connection.rb
symphonia-3.0.0 lib/symphonia/action_cable/connection.rb
symphonia-2.1.8 lib/symphonia/action_cable/connection.rb
symphonia-2.1.7 lib/symphonia/action_cable/connection.rb