[ARVADOS] updated: 01b6cbdfef9690a4b1aba815df63c3d7ee6b97ed
Git user
git at public.curoverse.com
Thu Aug 24 22:02:21 EDT 2017
Summary of changes:
services/api/app/models/arvados_model.rb | 9 ++++++++-
services/api/test/unit/group_test.rb | 8 +++++---
2 files changed, 13 insertions(+), 4 deletions(-)
via 01b6cbdfef9690a4b1aba815df63c3d7ee6b97ed (commit)
from 6b928cd8adc2ed93f4b7f3d1be8e933e3b1a572b (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 01b6cbdfef9690a4b1aba815df63c3d7ee6b97ed
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Aug 24 21:58:38 2017 -0400
12032: Fix hiding trashed groups directly owned by user.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/services/api/app/models/arvados_model.rb b/services/api/app/models/arvados_model.rb
index 5a9d43f..ccd8f82 100644
--- a/services/api/app/models/arvados_model.rb
+++ b/services/api/app/models/arvados_model.rb
@@ -293,7 +293,14 @@ class ArvadosModel < ActiveRecord::Base
(#{sql_table}.owner_uuid = pv.target_uuid AND pv.target_owner_uuid is NOT NULL)))"]
# Match any object whose owner is listed explicitly in
# user_uuids.
- sql_conds += ["#{sql_table}.owner_uuid IN (:user_uuids)"]
+ trash_clause = if !include_trashed
+ "1 NOT IN (SELECT trashed
+ FROM permission_view pv
+ WHERE #{sql_table}.uuid = pv.target_uuid) AND"
+ else
+ ""
+ end
+ sql_conds += ["(#{trash_clause} #{sql_table}.owner_uuid IN (:user_uuids))"]
else
sql_conds += ["EXISTS(SELECT target_uuid
FROM permission_view pv
diff --git a/services/api/test/unit/group_test.rb b/services/api/test/unit/group_test.rb
index 11f546b..e2c8829 100644
--- a/services/api/test/unit/group_test.rb
+++ b/services/api/test/unit/group_test.rb
@@ -90,10 +90,12 @@ class GroupTest < ActiveSupport::TestCase
assert Group.readable_by(users(:active)).where(uuid: g_bar.uuid).empty?
assert Collection.readable_by(users(:active)).where(uuid: col.uuid).empty?
- assert Group.readable_by(users(:active), {:include_trashed => true}).where(uuid: g_foo.uuid).any?
- assert Group.readable_by(users(:active), {:include_trashed => true}).where(uuid: g_bar.uuid).any?
- assert Collection.readable_by(users(:active), {:include_trashed => true}).where(uuid: col.uuid).any?
+ set_user_from_auth :admin
+ assert Group.readable_by(users(:active)).where(uuid: g_foo.uuid).empty?
+ assert Group.readable_by(users(:active)).where(uuid: g_bar.uuid).empty?
+ assert Collection.readable_by(users(:active)).where(uuid: col.uuid).empty?
+ set_user_from_auth :active_trustedclient
g_foo.update! is_trashed: false
assert Group.readable_by(users(:active)).where(uuid: g_foo.uuid).any?
assert Group.readable_by(users(:active)).where(uuid: g_bar.uuid).any?
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list