[ARVADOS] created: 2.1.0-1415-g70725146d

Git user git at public.arvados.org
Tue Sep 28 20:39:00 UTC 2021


        at  70725146d059e6ac260b17dd89545093646cba02 (commit)


commit 70725146d059e6ac260b17dd89545093646cba02
Author: Ward Vandewege <ward at curii.com>
Date:   Tue Sep 28 16:38:34 2021 -0400

    18003: add 'contains' and 'exists' to the permitted operators for filter
           groups.
    
    Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>

diff --git a/sdk/go/arvados/fs_project_test.go b/sdk/go/arvados/fs_project_test.go
index 0564e2fae..ce25865fa 100644
--- a/sdk/go/arvados/fs_project_test.go
+++ b/sdk/go/arvados/fs_project_test.go
@@ -73,6 +73,24 @@ func (s *SiteFSSuite) TestFilterGroup(c *check.C) {
 
 	_, err = s.fs.OpenFile("/fg3/A Subproject", 0, 0)
 	c.Assert(err, check.Not(check.IsNil))
+
+	// An 'exists' 'arvados#collection' filter means only collections with certain properties should be returned.
+	s.fs.MountProject("fg4", fixtureAFilterGroupFourUUID)
+
+	_, err = s.fs.OpenFile("/fg4/collection with list property with odd values", 0, 0)
+	c.Assert(err, check.IsNil)
+
+	_, err = s.fs.OpenFile("/fg4/collection with list property with even values", 0, 0)
+	c.Assert(err, check.IsNil)
+
+	// A 'contains' 'arvados#collection' filter means only collections with certain properties should be returned.
+	s.fs.MountProject("fg5", fixtureAFilterGroupFiveUUID)
+
+	_, err = s.fs.OpenFile("/fg4/collection with list property with odd values", 0, 0)
+	c.Assert(err, check.IsNil)
+
+	_, err = s.fs.OpenFile("/fg4/collection with list property with even values", 0, 0)
+	c.Assert(err, check.Not(check.IsNil))
 }
 
 func (s *SiteFSSuite) TestCurrentUserHome(c *check.C) {
diff --git a/sdk/go/arvados/fs_site_test.go b/sdk/go/arvados/fs_site_test.go
index 3c7c146f6..51ca88764 100644
--- a/sdk/go/arvados/fs_site_test.go
+++ b/sdk/go/arvados/fs_site_test.go
@@ -21,6 +21,8 @@ const (
 	fixtureThisFilterGroupUUID          = "zzzzz-j7d0g-thisfiltergroup"
 	fixtureAFilterGroupTwoUUID          = "zzzzz-j7d0g-afiltergrouptwo"
 	fixtureAFilterGroupThreeUUID        = "zzzzz-j7d0g-filtergroupthre"
+	fixtureAFilterGroupFourUUID         = "zzzzz-j7d0g-filtergroupfour"
+	fixtureAFilterGroupFiveUUID         = "zzzzz-j7d0g-filtergroupfive"
 	fixtureFooAndBarFilesInDirUUID      = "zzzzz-4zz18-foonbarfilesdir"
 	fixtureFooCollectionName            = "zzzzz-4zz18-fy296fx3hot09f7 added sometime"
 	fixtureFooCollectionPDH             = "1f4b0bc7583c2a7f9102c395f4ffc5e3+45"
diff --git a/services/api/app/models/group.rb b/services/api/app/models/group.rb
index fd2f5f18c..8565b2a41 100644
--- a/services/api/app/models/group.rb
+++ b/services/api/app/models/group.rb
@@ -84,8 +84,8 @@ class Group < ArvadosModel
           errors.add :properties, "when filter operator is 'is_a', attribute must be 'uuid'"
           return
         end
-        if ! ["=","<","<=",">",">=","!=","like","ilike","in","not in","is_a"].include?(filter[1].downcase)
-          errors.add :properties, "filter operator is not valid (must be =,<,<=,>,>=,!=,like,ilike,in,not in,is_a)"
+        if ! ["=","<","<=",">",">=","!=","like","ilike","in","not in","is_a","exists","contains"].include?(filter[1].downcase)
+          errors.add :properties, "filter operator is not valid (must be =,<,<=,>,>=,!=,like,ilike,in,not in,is_a,exists,contains)"
           return
         end
       end
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index 48925a270..429393467 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -146,6 +146,32 @@ afiltergroup3:
   properties:
     filters: [["uuid", "is_a", "arvados#collection"]]
 
+afiltergroup4:
+  uuid: zzzzz-j7d0g-filtergroupfour
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-04-21 15:37:48 -0400
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  modified_at: 2014-04-21 15:37:48 -0400
+  updated_at: 2014-04-21 15:37:48 -0400
+  name: A filter group with an exists collections filter
+  group_class: filter
+  properties:
+    filters: [["groups.properties.listprop","exists",true],["uuid", "is_a", "arvados#collection"]]
+
+afiltergroup5:
+  uuid: zzzzz-j7d0g-filtergroupfive
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-04-21 15:37:48 -0400
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  modified_at: 2014-04-21 15:37:48 -0400
+  updated_at: 2014-04-21 15:37:48 -0400
+  name: A filter group with a contains collections filter
+  group_class: filter
+  properties:
+    filters: [["groups.properties.listprop","contains","elem1"],["uuid", "is_a", "arvados#collection"]]
+
 future_project_viewing_group:
   uuid: zzzzz-j7d0g-futrprojviewgrp
   owner_uuid: zzzzz-tpzed-000000000000000

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list