[ARVADOS] updated: afa9eee9105d402afdbd3110489cb08b58f81e10
git at public.curoverse.com
git at public.curoverse.com
Mon Apr 21 11:09:00 EDT 2014
Summary of changes:
apps/workbench/app/views/websocket/index.html.erb | 2 +-
.../controllers/arvados/v1/events_controller.rb | 32 +++++++++++++++++++-
2 files changed, 32 insertions(+), 2 deletions(-)
via afa9eee9105d402afdbd3110489cb08b58f81e10 (commit)
from 052cfead6e6e87d605cbe7beece4752ee78aa62f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit afa9eee9105d402afdbd3110489cb08b58f81e10
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Apr 21 11:08:57 2014 -0400
Now checks for API token on websocket connection to determine the user.
diff --git a/apps/workbench/app/views/websocket/index.html.erb b/apps/workbench/app/views/websocket/index.html.erb
index 21ec7ac..d4259a9 100644
--- a/apps/workbench/app/views/websocket/index.html.erb
+++ b/apps/workbench/app/views/websocket/index.html.erb
@@ -19,7 +19,7 @@ putStuffThere = function (content) {
$("#PutStuffHere").append(content["message"] + "<br>");
};
-var dispatcher = new WebSocketRails('localhost:3032/arvados/v1/events');
+var dispatcher = new WebSocketRails('localhost:3032/arvados/v1/events?api_token=<%= Thread.current[:arvados_api_token] %>');
dispatcher.bind('hello', putStuffThere);
sendStuff = function () {
diff --git a/services/api/app/controllers/arvados/v1/events_controller.rb b/services/api/app/controllers/arvados/v1/events_controller.rb
index 473348b..c135b3e 100644
--- a/services/api/app/controllers/arvados/v1/events_controller.rb
+++ b/services/api/app/controllers/arvados/v1/events_controller.rb
@@ -7,10 +7,40 @@ class Arvados::V1::EventsController < WebsocketRails::BaseController
end
def client_connected
+ # api_client_auth = ApiClientAuthorization.
+ # includes(:api_client, :user).
+ # where('api_token=? and (expires_at is null or expires_at > CURRENT_TIMESTAMP)', params[:api_token]).
+ # first
+ # if api_client_auth.andand.user
+ # connection_store[:user_id] = api_client_auth.user.id
+ # connection_store[:api_client_uuid] = api_client_auth.api_client.andand.uuid
+ # connection_store[:api_client_authorization_id] = api_client_auth.id
+ # user = api_client_auth.user
+ # api_client = api_client_auth.api_client
+ # else
+ # # Token seems valid, but points to a non-existent (deleted?) user.
+ # api_client_auth = nil
+ # end
+
+ puts "#{client_id}"
+ WebsocketRails.users[client_id] = connection
+ WebsocketRails.users.each do |c|
+ puts "XXXXXXXXXXXXXXXXX #{c}"
+ end
+ puts "not good enough"
+
send_message :hello, {:message => "hello world!"}
end
def hello
- send_message :hello, {:message => "Nice to meetcha #{message['name']}"}
+ puts "#{message} #{WebsocketRails.users}"
+ WebsocketRails.users.each do |c|
+ puts "#{c}"
+ c.send_message :hello, {:message => "Everyone say hello to #{message['name']}"}
+ end
+ end
+
+ def listen
+
end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list