Sha256: 27b390c4fe5b44ae8d93a2af5686579a51477d394c8ea34931dbdb7c62eb1361

Contents?: true

Size: 485 Bytes

Versions: 25

Compression:

Stored size: 485 Bytes

Contents

module ApplicationCable
  class Connection < ActionCable::Connection::Base
    identified_by :loco_permissions

    def connect
      self.loco_permissions = [SecureRandom.uuid, current_user, current_admin]
      logger.add_tags 'AC', loco_permissions.map{ |e| e.try(:id) || '-' }
    end

    protected

      def current_admin
        Admin.find_by id: cookies.signed[:admin_id]
      end

      def current_user
        User.find_by id: cookies.signed[:user_id]
      end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
loco-rails-3.0.5 test/dummy/app/channels/application_cable/connection.rb
loco-rails-3.0.4 test/dummy/app/channels/application_cable/connection.rb
loco-rails-3.0.3 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.5.3 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.5.2 test/dummy/app/channels/application_cable/connection.rb
loco-rails-3.0.2 test/dummy/app/channels/application_cable/connection.rb
loco-rails-3.0.1 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.5.1 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.5.0 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.4.0 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.3.0 test/dummy/app/channels/application_cable/connection.rb
loco-rails-3.0.0 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.2.2 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.2.1 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.2.0 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.1.0 test/dummy/app/channels/application_cable/connection.rb
loco-rails-2.0.0 test/dummy/app/channels/application_cable/connection.rb
loco-rails-1.5.2 test/dummy/app/channels/application_cable/connection.rb
loco-rails-1.5.1 test/dummy/app/channels/application_cable/connection.rb
loco-rails-1.5.0 test/dummy/app/channels/application_cable/connection.rb