8079: add uuid to api_client_authorizations_search_index and add uuid to all api_clie...
authorradhika <radhika@curoverse.com>
Tue, 9 Feb 2016 16:11:59 +0000 (11:11 -0500)
committerradhika <radhika@curoverse.com>
Tue, 9 Feb 2016 16:11:59 +0000 (11:11 -0500)
services/api/app/models/api_client_authorization.rb
services/api/db/migrate/20160209155729_add_uuid_to_api_token_search_index.rb [new file with mode: 0644]
services/api/db/structure.sql
services/api/test/fixtures/api_client_authorizations.yml

index b9442d64e78bf888741e9e47d532f53d73059e22..c587e5830af41549c5bd637c7ffa9472bbf51017 100644 (file)
@@ -1,4 +1,5 @@
 class ApiClientAuthorization < ArvadosModel
+  include HasUuid
   include KindAndEtag
   include CommonApiTemplate
 
@@ -36,17 +37,6 @@ class ApiClientAuthorization < ArvadosModel
     self.user_id_changed?
   end
 
-  def uuid
-    self.api_token
-  end
-  def uuid=(x) end
-  def uuid_was
-    self.api_token_was
-  end
-  def uuid_changed?
-    self.api_token_changed?
-  end
-
   def modified_by_client_uuid
     nil
   end
diff --git a/services/api/db/migrate/20160209155729_add_uuid_to_api_token_search_index.rb b/services/api/db/migrate/20160209155729_add_uuid_to_api_token_search_index.rb
new file mode 100644 (file)
index 0000000..c246591
--- /dev/null
@@ -0,0 +1,8 @@
+class AddUuidToApiTokenSearchIndex < ActiveRecord::Migration
+  def change
+    remove_index :api_client_authorizations, :name => 'api_client_authorizations_search_index'
+         add_index :api_client_authorizations,
+              ["api_token", "created_by_ip_address", "last_used_by_ip_address", "default_owner_uuid", "uuid"],
+              name: "api_client_authorizations_search_index"
+  end
+end
index 5e0c4d0f07a8bf4ad44fcc6605c6925bc0f48587..e482e6e607b4141bbbc00f9b70352852be62ac90 100644 (file)
@@ -1415,7 +1415,7 @@ ALTER TABLE ONLY virtual_machines
 -- Name: api_client_authorizations_search_index; Type: INDEX; Schema: public; Owner: -; Tablespace: 
 --
 
-CREATE INDEX api_client_authorizations_search_index ON api_client_authorizations USING btree (api_token, created_by_ip_address, last_used_by_ip_address, default_owner_uuid);
+CREATE INDEX api_client_authorizations_search_index ON api_client_authorizations USING btree (api_token, created_by_ip_address, last_used_by_ip_address, default_owner_uuid, uuid);
 
 
 --
@@ -2578,4 +2578,6 @@ INSERT INTO schema_migrations (version) VALUES ('20151215134304');
 
 INSERT INTO schema_migrations (version) VALUES ('20151229214707');
 
-INSERT INTO schema_migrations (version) VALUES ('20160208210629');
\ No newline at end of file
+INSERT INTO schema_migrations (version) VALUES ('20160208210629');
+
+INSERT INTO schema_migrations (version) VALUES ('20160209155729');
\ No newline at end of file
index 7169ebdc8a3699b84df58d6f090c32f289546582..f99a9fb941f1b26f44d2d4b4035a28afd84fbc08 100644 (file)
@@ -1,24 +1,28 @@
 # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
 
 system_user:
+  uuid: zzzzz-gj3su-017z32aux8dg2s1
   api_client: untrusted
   user: system_user
   api_token: systemusertesttoken1234567890aoeuidhtnsqjkxbmwvzpy
   expires_at: 2038-01-01 00:00:00
 
 admin:
+  uuid: zzzzz-gj3su-027z32aux8dg2s1
   api_client: untrusted
   user: admin
   api_token: 4axaw8zxe0qm22wa6urpp5nskcne8z88cvbupv653y1njyi05h
   expires_at: 2038-01-01 00:00:00
 
 admin_trustedclient:
+  uuid: zzzzz-gj3su-037z32aux8dg2s1
   api_client: trusted_workbench
   user: admin
   api_token: 1a9ffdcga2o7cw8q12dndskomgs1ygli3ns9k2o9hgzgmktc78
   expires_at: 2038-01-01 00:00:00
 
 data_manager:
+  uuid: zzzzz-gj3su-047z32aux8dg2s1
   api_client: untrusted
   user: system_user
   api_token: 320mkve8qkswstz7ff61glpk3mhgghmg67wmic7elw4z41pke1
@@ -31,30 +35,35 @@ data_manager:
     - POST /arvados/v1/logs
 
 miniadmin:
+  uuid: zzzzz-gj3su-057z32aux8dg2s1
   api_client: untrusted
   user: miniadmin
   api_token: 2zb2y9pw3e70270te7oe3ewaantea3adyxjascvkz0zob7q7xb
   expires_at: 2038-01-01 00:00:00
 
 rominiadmin:
+  uuid: zzzzz-gj3su-067z32aux8dg2s1
   api_client: untrusted
   user: rominiadmin
   api_token: 5tsb2pc3zlatn1ortl98s2tqsehpby88wmmnzmpsjmzwa6payh
   expires_at: 2038-01-01 00:00:00
 
 active:
+  uuid: zzzzz-gj3su-077z32aux8dg2s1
   api_client: untrusted
   user: active
   api_token: 3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi
   expires_at: 2038-01-01 00:00:00
 
 active_trustedclient:
+  uuid: zzzzz-gj3su-087z32aux8dg2s1
   api_client: trusted_workbench
   user: active
   api_token: 27bnddk6x2nmq00a1e3gq43n9tsl5v87a3faqar2ijj8tud5en
   expires_at: 2038-01-01 00:00:00
 
 active_noscope:
+  uuid: zzzzz-gj3su-097z32aux8dg2s1
   api_client: untrusted
   user: active
   api_token: activenoscopeabcdefghijklmnopqrstuvwxyz12345678901
@@ -62,24 +71,28 @@ active_noscope:
   scopes: []
 
 project_viewer:
+  uuid: zzzzz-gj3su-107z32aux8dg2s1
   api_client: untrusted
   user: project_viewer
   api_token: projectviewertoken1234567890abcdefghijklmnopqrstuv
   expires_at: 2038-01-01 00:00:00
 
 project_viewer_trustedclient:
+  uuid: zzzzz-gj3su-117z32aux8dg2s1
   api_client: trusted_workbench
   user: project_viewer
   api_token: projectviewertrustedtoken1234567890abcdefghijklmno
   expires_at: 2038-01-01 00:00:00
 
 subproject_admin:
+  uuid: zzzzz-gj3su-127z32aux8dg2s1
   api_client: untrusted
   user: subproject_admin
   api_token: subprojectadmintoken1234567890abcdefghijklmnopqrst
   expires_at: 2038-01-01 00:00:00
 
 admin_vm:
+  uuid: zzzzz-gj3su-137z32aux8dg2s1
   api_client: untrusted
   user: admin
   api_token: adminvirtualmachineabcdefghijklmnopqrstuvwxyz12345
@@ -88,6 +101,7 @@ admin_vm:
   scopes: ["GET /arvados/v1/virtual_machines/zzzzz-2x53u-382brsig8rp3064/logins"]
 
 admin_noscope:
+  uuid: zzzzz-gj3su-147z32aux8dg2s1
   api_client: untrusted
   user: admin
   api_token: adminnoscopeabcdefghijklmnopqrstuvwxyz123456789012
@@ -95,6 +109,7 @@ admin_noscope:
   scopes: []
 
 active_all_collections:
+  uuid: zzzzz-gj3su-157z32aux8dg2s1
   api_client: untrusted
   user: active
   api_token: activecollectionsabcdefghijklmnopqrstuvwxyz1234567
@@ -102,6 +117,7 @@ active_all_collections:
   scopes: ["GET /arvados/v1/collections/", "GET /arvados/v1/keep_services/accessible"]
 
 active_userlist:
+  uuid: zzzzz-gj3su-167z32aux8dg2s1
   api_client: untrusted
   user: active
   api_token: activeuserlistabcdefghijklmnopqrstuvwxyz1234568900
@@ -109,6 +125,7 @@ active_userlist:
   scopes: ["GET /arvados/v1/users"]
 
 active_specimens:
+  uuid: zzzzz-gj3su-177z32aux8dg2s1
   api_client: untrusted
   user: active
   api_token: activespecimensabcdefghijklmnopqrstuvwxyz123456890
@@ -116,6 +133,7 @@ active_specimens:
   scopes: ["GET /arvados/v1/specimens/"]
 
 active_apitokens:
+  uuid: zzzzz-gj3su-187z32aux8dg2s1
   api_client: trusted_workbench
   user: active
   api_token: activeapitokensabcdefghijklmnopqrstuvwxyz123456789
@@ -124,6 +142,7 @@ active_apitokens:
            "POST /arvados/v1/api_client_authorizations"]
 
 active_readonly:
+  uuid: zzzzz-gj3su-197z32aux8dg2s1
   api_client: untrusted
   user: active
   api_token: activereadonlyabcdefghijklmnopqrstuvwxyz1234568790
@@ -131,12 +150,14 @@ active_readonly:
   scopes: ["GET /"]
 
 spectator:
+  uuid: zzzzz-gj3su-207z32aux8dg2s1
   api_client: untrusted
   user: spectator
   api_token: zw2f4gwx8hw8cjre7yp6v1zylhrhn3m5gvjq73rtpwhmknrybu
   expires_at: 2038-01-01 00:00:00
 
 spectator_specimens:
+  uuid: zzzzz-gj3su-217z32aux8dg2s1
   api_client: untrusted
   user: spectator
   api_token: spectatorspecimensabcdefghijklmnopqrstuvwxyz123245
@@ -145,42 +166,49 @@ spectator_specimens:
            "POST /arvados/v1/specimens"]
 
 inactive:
+  uuid: zzzzz-gj3su-227z32aux8dg2s1
   api_client: untrusted
   user: inactive
   api_token: 5s29oj2hzmcmpq80hx9cta0rl5wuf3xfd6r7disusaptz7h9m0
   expires_at: 2038-01-01 00:00:00
 
 inactive_uninvited:
+  uuid: zzzzz-gj3su-237z32aux8dg2s1
   api_client: untrusted
   user: inactive_uninvited
   api_token: 62mhllc0otp78v08e3rpa3nsmf8q8ogk47f7u5z4erp5gpj9al
   expires_at: 2038-01-01 00:00:00
 
 inactive_but_signed_user_agreement:
+  uuid: zzzzz-gj3su-247z32aux8dg2s1
   api_client: untrusted
   user: inactive_but_signed_user_agreement
   api_token: 64k3bzw37iwpdlexczj02rw3m333rrb8ydvn2qq99ohv68so5k
   expires_at: 2038-01-01 00:00:00
 
 expired:
+  uuid: zzzzz-gj3su-257z32aux8dg2s1
   api_client: untrusted
   user: active
   api_token: 2ym314ysp27sk7h943q6vtc378srb06se3pq6ghurylyf3pdmx
   expires_at: 1970-01-01 00:00:00
 
 expired_trustedclient:
+  uuid: zzzzz-gj3su-267z32aux8dg2s1
   api_client: trusted_workbench
   user: active
   api_token: 5hpni7izokzcatku2896xxwqdbt5ptomn04r6auc7fohnli82v
   expires_at: 1970-01-01 00:00:00
 
 valid_token_deleted_user:
+  uuid: zzzzz-gj3su-277z32aux8dg2s1
   api_client: trusted_workbench
   user_id: 1234567
   api_token: tewfa58099sndckyqhlgd37za6e47o6h03r9l1vpll23hudm8b
   expires_at: 2038-01-01 00:00:00
 
 anonymous:
+  uuid: zzzzz-gj3su-287z32aux8dg2s1
   api_client: untrusted
   user: anonymous
   api_token: 4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi
@@ -188,48 +216,56 @@ anonymous:
   scopes: ["GET /"]
 
 job_reader:
+  uuid: zzzzz-gj3su-297z32aux8dg2s1
   api_client: untrusted
   user: job_reader
   api_token: e99512cdc0f3415c2428b9758f33bdfb07bc3561b00e86e7e6
   expires_at: 2038-01-01 00:00:00
 
 active_no_prefs:
+  uuid: zzzzz-gj3su-307z32aux8dg2s1
   api_client: untrusted
   user: active_no_prefs
   api_token: 3kg612cdc0f3415c2428b9758f33bdfb07bc3561b00e86qdmi
   expires_at: 2038-01-01 00:00:00
 
 active_no_prefs_profile_no_getting_started_shown:
+  uuid: zzzzz-gj3su-317z32aux8dg2s1
   api_client: untrusted
   user: active_no_prefs_profile_no_getting_started_shown
   api_token: 3kg612cdc0f3415c242856758f33bdfb07bc3561b00e86qdmi
   expires_at: 2038-01-01 00:00:00
 
 active_no_prefs_profile_with_getting_started_shown:
+  uuid: zzzzz-gj3su-327z32aux8dg2s1
   api_client: untrusted
   user: active_no_prefs_profile_with_getting_started_shown
   api_token: 3kg612cdc0f3415c245786758f33bdfb07babcd1b00e86qdmi
   expires_at: 2038-01-01 00:00:00
 
 active_with_prefs_profile_no_getting_started_shown:
+  uuid: zzzzz-gj3su-337z32aux8dg2s1
   api_client: untrusted
   user: active_with_prefs_profile_no_getting_started_shown
   api_token: 3kg612cdc0f3415c245786758f33bdfb07befgh1b00e86qdmi
   expires_at: 2038-01-01 00:00:00
 
 user_foo_in_sharing_group:
+  uuid: zzzzz-gj3su-347z32aux8dg2s1
   api_client: untrusted
   user: user_foo_in_sharing_group
   api_token: 2p1pou8p4ls208mcbedeewlotghppenobcyrmyhq8pyf51xd8u
   expires_at: 2038-01-01 00:00:00
 
 user1_with_load:
+  uuid: zzzzz-gj3su-357z32aux8dg2s1
   api_client: untrusted
   user: user1_with_load
   api_token: 1234k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi
   expires_at: 2038-01-01 00:00:00
 
 fuse:
+  uuid: zzzzz-gj3su-367z32aux8dg2s1
   api_client: untrusted
   user: fuse
   api_token: 4nagbkv8eap0uok7pxm72nossq5asihls3yn5p4xmvqx5t5e7p