aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/action_cable/channel/base.rb33
1 files changed, 8 insertions, 25 deletions
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