[ARVADOS] updated: 72fab72c18b18af90b7a820b0b6cfd881ced987c
git at public.curoverse.com
git at public.curoverse.com
Thu Jun 12 11:04:24 EDT 2014
Summary of changes:
.../app/controllers/application_controller.rb | 168 ++++++++++++
apps/workbench/app/helpers/application_helper.rb | 52 +++-
.../app/views/application/_show_metadata.html.erb | 12 +
apps/workbench/app/views/users/_tables.html.erb | 51 +++-
.../test/functional/application_controller_test.rb | 299 +++++++++++++++++++++
.../db/migrate/20140610210837_anonymous_group.rb | 17 ++
services/api/db/schema.rb | 3 +-
services/api/db/seeds.rb | 6 +-
services/api/lib/current_api_client.rb | 58 ++++
services/api/test/fixtures/groups.yml | 6 +
services/api/test/fixtures/users.yml | 7 +
.../src/arvados.org/crunchstat/crunchstat.go | 30 ++-
12 files changed, 670 insertions(+), 39 deletions(-)
create mode 100644 apps/workbench/test/functional/application_controller_test.rb
create mode 100644 services/api/db/migrate/20140610210837_anonymous_group.rb
via 72fab72c18b18af90b7a820b0b6cfd881ced987c (commit)
via 4880e56df98982397fbdb2d9ee98e929cf6f5818 (commit)
via bba95a22451284c2d4d6787cd2e3fa98c3c21cdf (commit)
via 7e57f7b23f2580894e183ddb33c36e1556336a69 (commit)
via a9beb0e51fdd2782c4aeaa1f5c2d20d6ad7dd435 (commit)
via 9bda231180fc58e67b0c322c16be223154965b66 (commit)
via 85ce092000d72c5dda03bd4763c9613bb9a46437 (commit)
via 7ccba0ea6cb9916a1bad55f13cc45029f0bc37bd (commit)
via eaa312ea7c35e35c64dbef9624be1d9c7df034ef (commit)
via 3692a4ac4d8f76d2e704af5e504652650b4a00cc (commit)
via 73c0b152d18774266e72916d6f8cedb3199b535c (commit)
via 2cdc648b5367efd4c8e7b2ede93a2b3ba0871c17 (commit)
via 97a1da1dfde9ef3ef195f7513309da8c6bb17978 (commit)
via a2bcc06c1bda757ed8c869d7f9ad235f56abdcf4 (commit)
via dd6e25d53f9cf02f91b419584ff4c331e0618a24 (commit)
via 400829b3835f0a129116a2eed926d12a0636aeab (commit)
via f6e5ba4510e2072415a8d6b5369b11b8003ddafa (commit)
via 55b94087ff4590c54cf1f43d941c6cb24153dded (commit)
via 408649cc0e9ad3d30296b0750680fb62fefe6d82 (commit)
via 1bd85c64fbf485acceac4711ff06e6b2f548d40a (commit)
via f3da69fb1b882c7fe8feb765ad0558f13706931a (commit)
via 620a10bed55b85294baad9dba965ea8dad59e884 (commit)
via f3b4b263d8c656e15993ea71146747e8cf102bf9 (commit)
via 16cc50a4161448f9987635e06fe3d772ee0321ab (commit)
via 25f3a23bc8794b77a1b5fa1e5e7f9c38a152dd8f (commit)
via 33fed6bb30180c9dedb046d6266acbbc48dcfcd4 (commit)
via 87dc5129e903cb7452e06c936d8e5e581c4d2481 (commit)
via bc784d9eeadfc04aedea9772bb8913f5e8b86cd1 (commit)
via 10486fd2453c92a62c0a97491259d1391e5cb872 (commit)
via cdc46777d33cc341969ba791175a8ca0925e77dc (commit)
via 570201300b90a676b4bc49ea02627d1057386615 (commit)
via 3674d731b92e091811872eef0b909171d3574614 (commit)
via 03812184bfa1ab7f17960ef48ff30798333bdd54 (commit)
via 6b13646940de2e5a62e600f2d7d82c72e3a4ae59 (commit)
via dfe74093596d3d7378e6f0d3e5f843f44d987074 (commit)
via ca77755f57b0478e3f4fbe3e6a6d7ade95012808 (commit)
via 66da5859254325690a78512d03b6b02e3f69a237 (commit)
via 349ab8f9e11d462c878cd6be6d24bf5790af3d50 (commit)
via 8c9fa09deea0cb68b68f110fdbb1b1daa50a618c (commit)
via 161478d5be79e83f3e200b46f0d8d003caa2ffe0 (commit)
via ec08a1b9aefcd801d1f0c0b282b268cbee6939bc (commit)
via 2f1baf225599d7ae5dec4611696774e6a7100d58 (commit)
via f10a7f68c6ef25cf4ba87045201b17093a11249e (commit)
from 5da7bddd63790e524e4b22a6944a92065409241d (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 72fab72c18b18af90b7a820b0b6cfd881ced987c
Merge: 4880e56 bba95a2
Author: radhika <radhika at curoverse.com>
Date: Thu Jun 12 11:04:01 2014 -0400
Merge branch 'master' into 2659-anonymous-group
commit 4880e56df98982397fbdb2d9ee98e929cf6f5818
Author: radhika <radhika at curoverse.com>
Date: Thu Jun 12 11:02:59 2014 -0400
2659: db migration to add anonymous group and user
diff --git a/services/api/db/migrate/20140610210837_anonymous_group.rb b/services/api/db/migrate/20140610210837_anonymous_group.rb
new file mode 100644
index 0000000..0bb7608
--- /dev/null
+++ b/services/api/db/migrate/20140610210837_anonymous_group.rb
@@ -0,0 +1,17 @@
+class AnonymousGroup < ActiveRecord::Migration
+ include CurrentApiClient
+
+ def up
+ # create the anonymous group and user
+ anonymous_group
+ anonymous_user
+ end
+
+ def down
+ act_as_system_user do
+ anonymous_user.destroy
+ anonymous_group.destroy
+ end
+ end
+
+end
diff --git a/services/api/db/schema.rb b/services/api/db/schema.rb
index 1ef80ab..1dadaf6 100644
--- a/services/api/db/schema.rb
+++ b/services/api/db/schema.rb
@@ -11,8 +11,9 @@
#
# It's strongly recommended to check this file into your version control system.
+ActiveRecord::Schema.define(:version => 20140610210837) do
+
-ActiveRecord::Schema.define(:version => 20140602143352) do
create_table "api_client_authorizations", :force => true do |t|
t.string "api_token", :null => false
diff --git a/services/api/db/seeds.rb b/services/api/db/seeds.rb
index 1f17bc8..abd325c 100644
--- a/services/api/db/seeds.rb
+++ b/services/api/db/seeds.rb
@@ -2,8 +2,10 @@
#
# It is invoked by `rake db:seed` and `rake db:setup`.
-# These two methods would create the system user and group objects on
-# demand later anyway, but it's better form to create them up front.
+# These two methods would create these objects on demand
+# later anyway, but it's better form to create them up front.
include CurrentApiClient
system_user
system_group
+anonymous_group
+anonymous_user
diff --git a/services/api/lib/current_api_client.rb b/services/api/lib/current_api_client.rb
index f851c58..448eeac 100644
--- a/services/api/lib/current_api_client.rb
+++ b/services/api/lib/current_api_client.rb
@@ -41,6 +41,18 @@ module CurrentApiClient
'000000000000000'].join('-')
end
+ def anonymous_group_uuid
+ [Server::Application.config.uuid_prefix,
+ Group.uuid_prefix,
+ 'anonymouspublic'].join('-')
+ end
+
+ def anonymous_user_uuid
+ [Server::Application.config.uuid_prefix,
+ User.uuid_prefix,
+ 'anonymouspublic'].join('-')
+ end
+
def system_user
if not $system_user
real_current_user = Thread.current[:user]
@@ -99,4 +111,50 @@ module CurrentApiClient
Thread.current[:user] = system_user
end
end
+
+ def anonymous_group
+ if not $anonymous_group
+ act_as_system_user do
+ ActiveRecord::Base.transaction do
+ $anonymous_group = Group.
+ where(uuid: anonymous_group_uuid).first_or_create do |g|
+ g.update_attributes(name: "Anonymous group",
+ description: "Anonymous group")
+ end
+ end
+ end
+ end
+ $anonymous_group
+ end
+
+ def anonymous_user
+ if not $anonymous_user
+ act_as_system_user do
+ $anonymous_user = User.where('uuid=?', anonymous_user_uuid).first
+ if !$anonymous_user
+ $anonymous_user = User.new(uuid: anonymous_user_uuid,
+ is_active: true,
+ is_admin: false,
+ first_name: 'anonymous',
+ last_name: 'anonymous')
+ $anonymous_user.save!
+ $anonymous_user.reload
+
+ group_perms = Link.where(tail_uuid: anonymous_user_uuid,
+ head_uuid: anonymous_group_uuid,
+ link_class: 'permission',
+ name: 'can_read')
+
+ if !group_perms.any?
+ group_perm = Link.create(tail_uuid: anonymous_user_uuid,
+ head_uuid: anonymous_group_uuid,
+ link_class: 'permission',
+ name: 'can_read')
+ end
+ end
+ end
+ end
+ $anonymous_user
+ end
+
end
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index 96db93c..8959ada 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -87,3 +87,9 @@ bad_group_has_ownership_cycle_b:
modified_at: 2014-05-03 18:50:08 -0400
updated_at: 2014-05-03 18:50:08 -0400
name: Owned by bad group a
+
+anonymous_group:
+ uuid: zzzzz-j7d0g-anonymouspublic
+ owner_uuid: zzzzz-tpzed-000000000000000
+ name: Anonymous group
+ description: Anonymous group
diff --git a/services/api/test/fixtures/users.yml b/services/api/test/fixtures/users.yml
index c02ab61..80ab5ed 100644
--- a/services/api/test/fixtures/users.yml
+++ b/services/api/test/fixtures/users.yml
@@ -80,3 +80,10 @@ inactive_but_signed_user_agreement:
is_admin: false
prefs: {}
+anonymous:
+ uuid: zzzzz-tpzed-anonymouspublic
+ first_name: anonymous
+ last_name: anonymous
+ is_active: true
+ is_admin: false
+ prefs: {}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list