Remove the authorized check for now

We have the remote connections to immediately cut a connection when
someone has been kicked off. Let’s lean on that for now.
上级 a01317ee
......@@ -49,17 +49,13 @@ def initialize(connection, identifier, params = {})
# 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 @@ def unsubscribe_from_channel
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 @@ def unsubscribed
# 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册