[ARVADOS] updated: deb9df305fbe98e244e3f93607ac661fc8263717
git at public.curoverse.com
git at public.curoverse.com
Thu Apr 24 13:56:41 EDT 2014
Summary of changes:
.../api/app/controllers/application_controller.rb | 15 ++-
.../v1/api_client_authorizations_controller.rb | 5 +
.../app/controllers/arvados/v1/users_controller.rb | 2 +-
services/api/app/models/pipeline_instance.rb | 101 +++++++++++++++
.../20140422011506_pipeline_instance_state.rb | 87 +++++++++++++
services/api/db/schema.rb | 12 +-
services/api/lib/current_api_client.rb | 8 +-
services/api/test/fixtures/pipeline_instances.yml | 3 +
.../api_client_authorizations_controller_test.rb | 19 +++-
.../functional/arvados/v1/users_controller_test.rb | 25 ++++
.../api/test/integration/collections_api_test.rb | 36 ++++++
services/api/test/test_helper.rb | 18 +++
services/api/test/unit/application_test.rb | 32 +++++
services/api/test/unit/pipeline_instance_test.rb | 129 +++++++++++++++++++-
services/api/test/unit/user_test.rb | 2 +
15 files changed, 478 insertions(+), 16 deletions(-)
create mode 100644 services/api/db/migrate/20140422011506_pipeline_instance_state.rb
create mode 100644 services/api/test/fixtures/pipeline_instances.yml
create mode 100644 services/api/test/unit/application_test.rb
via deb9df305fbe98e244e3f93607ac661fc8263717 (commit)
via 725b9459d878b11d8d45fa12c99a06b400171574 (commit)
via d7c2dc9e850f35e1249ac37bc77d622881207725 (commit)
via 22db59393203f550e0c77e65c650e664667492ab (commit)
via 6a0ce3e88fc2122fe7749b6e4bc3eb01fb37b97c (commit)
via a955d5a89402d4b68ccec2d00c1ecf7d86334875 (commit)
via 1059fd1f9e22ebcae51413d2b0fde0416c71c79b (commit)
via 8072742e6557966b3e3d699e18fd3ee8656ed5b7 (commit)
via 007a1e6edf9125990e286c71b00f51405470a4a6 (commit)
via c92d3fcdc2ab6bc3ec9bb03567de9203ff9b1f79 (commit)
via 5cb205c567c312345376bcd2b7104075b5710d7f (commit)
via a3c5fac3f7849cab38bedd313b522b994be17b15 (commit)
from ab5c781a072ed673bba347b9418735b7007deeb4 (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 deb9df305fbe98e244e3f93607ac661fc8263717
Merge: d7c2dc9 725b945
Author: Brett Smith <brett at curoverse.com>
Date: Thu Apr 24 13:56:34 2014 -0400
Merge branch 'master' into 1904-object-scopes-wip
Conflicts:
services/api/db/schema.rb
diff --cc services/api/db/schema.rb
index 969b7c6,ab39901..576ab11
--- a/services/api/db/schema.rb
+++ b/services/api/db/schema.rb
@@@ -11,18 -11,18 +11,18 @@@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20140422011506) do
+ActiveRecord::Schema.define(:version => 20140423133559) do
create_table "api_client_authorizations", :force => true do |t|
-- t.string "api_token", :null => false
-- t.integer "api_client_id", :null => false
-- t.integer "user_id", :null => false
++ t.string "api_token", :null => false
++ t.integer "api_client_id", :null => false
++ t.integer "user_id", :null => false
t.string "created_by_ip_address"
t.string "last_used_by_ip_address"
t.datetime "last_used_at"
t.datetime "expires_at"
-- t.datetime "created_at", :null => false
-- t.datetime "updated_at", :null => false
++ t.datetime "created_at", :null => false
++ t.datetime "updated_at", :null => false
t.string "default_owner_uuid"
t.text "scopes", :default => "---\n- all\n", :null => false
end
@@@ -309,10 -311,12 +309,12 @@@
t.string "pipeline_template_uuid"
t.string "name"
t.text "components"
- t.datetime "updated_at"
- t.text "properties"
- t.boolean "active"
t.boolean "success"
+ t.boolean "active", :default => false
+ t.datetime "updated_at", :null => false
+ t.text "properties"
+ t.string "state"
+ t.text "components_summary"
end
add_index "pipeline_instances", ["created_at"], :name => "index_pipeline_instances_on_created_at"
commit d7c2dc9e850f35e1249ac37bc77d622881207725
Author: Brett Smith <brett at curoverse.com>
Date: Wed Apr 23 16:15:37 2014 -0400
api: Support scope searching in API token index.
diff --git a/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb b/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
index 8fd915d..ff322a7 100644
--- a/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
+++ b/services/api/app/controllers/arvados/v1/api_client_authorizations_controller.rb
@@ -45,6 +45,11 @@ class Arvados::V1::ApiClientAuthorizationsController < ApplicationController
includes(:user, :api_client).
where('user_id=? and (? or api_token=?)', current_user.id, !@where['uuid'], @where['uuid']).
order('created_at desc')
+ unless @where['scopes'].nil?
+ @objects = @objects.select { |auth|
+ (auth.scopes & @where['scopes']) == (auth.scopes | @where['scopes'])
+ }
+ end
end
def find_object_by_uuid
diff --git a/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb b/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb
index cbb0096..0072792 100644
--- a/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/api_client_authorizations_controller_test.rb
@@ -1,7 +1,6 @@
require 'test_helper'
class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::TestCase
-
test "should get index" do
authorize_with :active_trustedclient
get :index
@@ -38,4 +37,22 @@ class Arvados::V1::ApiClientAuthorizationsControllerTest < ActionController::Tes
assert_response 403
end
+ test "admin search filters where scopes exactly match" do
+ def check_tokens_by_scopes(scopes, *expected_tokens)
+ expected_tokens.map! { |name| api_client_authorizations(name).api_token }
+ get :index, where: {scopes: scopes}
+ assert_response :success
+ got_tokens = JSON.parse(@response.body)['items']
+ .map { |auth| auth['api_token'] }
+ assert_equal(expected_tokens.sort, got_tokens.sort,
+ "wrong results for scopes = #{scopes}")
+ end
+ authorize_with :admin_trustedclient
+ check_tokens_by_scopes([], :admin_noscope)
+ authorize_with :active_trustedclient
+ check_tokens_by_scopes(["GET /arvados/v1/users"], :active_userlist)
+ check_tokens_by_scopes(["POST /arvados/v1/api_client_authorizations",
+ "GET /arvados/v1/api_client_authorizations"],
+ :active_apitokens)
+ end
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list