From 35ffec2c489bead9cc7f9c0525e9c63dc04e3038 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 7 Jul 2015 21:25:14 +0200 Subject: Remove the authorized check for now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have the remote connections to immediately cut a connection when someone has been kicked off. Let’s lean on that for now. --- lib/action_cable/channel/base.rb | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) (limited to 'lib/action_cable/channel/base.rb') diff --git a/lib/action_cable/channel/base.rb b/lib/action_cable/channel/base.rb index ee22b29f4e..2fcc82d039 100644 --- a/lib/action_cable/channel/base.rb +++ b/lib/action_cable/channel/base.rb @@ -49,17 +49,13 @@ module ActionCable # that the action requested is a public method on the channel declared by the user (so not one of the callbacks # like #subscribed). def process_action(data) - if authorized? - action = extract_action(data) - - if processable_action?(action) - logger.info action_signature(action, data) - public_send action, data - else - logger.error "Unable to process #{action_signature(action, data)}" - end + action = extract_action(data) + + if processable_action?(action) + logger.info action_signature(action, data) + public_send action, data else - unauthorized + logger.error "Unable to process #{action_signature(action, data)}" end end @@ -70,15 +66,6 @@ module ActionCable protected - # Override in subclasses - def authorized? - true - end - - def unauthorized - logger.error "#{channel_name}: Unauthorized access" - end - # Called once a consumer has become a subscriber of the channel. Usually the place to setup any streams # you want this channel to be sending to the subscriber. def subscribed @@ -95,12 +82,8 @@ module ActionCable # Transmit a hash of data to the subscriber. The hash will automatically be wrapped in a JSON envelope with # the proper channel identifier marked as the recipient. def transmit(data, via: nil) - if authorized? - logger.info "#{channel_name} transmitting #{data.inspect}".tap { |m| m << " (via #{via})" if via } - connection.transmit({ identifier: @identifier, message: data }.to_json) - else - unauthorized - end + logger.info "#{channel_name} transmitting #{data.inspect}".tap { |m| m << " (via #{via})" if via } + connection.transmit({ identifier: @identifier, message: data }.to_json) end -- cgit v1.2.3