/groups/content endpoint.
Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>
options.Filters = append(options.Filters, filter)
}
}
+ // Use the generic /groups/contents endpoint for filter groups
+ options.UUID = ""
}
ep := arvados.EndpointGroupContents
return sc.Client.RequestAndDecode(dst, method, path, body, params)
}
-// TestFilterGroup is a very basic filter group test. It makes sure that a
-// collection and group that match the filter are present, and that a group
-// that does not match the filter is not present.
func (s *SiteFSSuite) TestFilterGroup(c *check.C) {
+ // Make sure that a collection and group that match the filter are present,
+ // and that a group that does not match the filter is not present.
s.fs.MountProject("fg", fixtureThisFilterGroupUUID)
_, err := s.fs.OpenFile("/fg/baz_file", 0, 0)
_, err = s.fs.OpenFile("/fg/A Project", 0, 0)
c.Assert(err, check.Not(check.IsNil))
+
+ // An empty filter means everything that is visible should be returned.
+ s.fs.MountProject("fg2", fixtureAFilterGroupTwoUUID)
+
+ _, err = s.fs.OpenFile("/fg2/baz_file", 0, 0)
+ c.Assert(err, check.IsNil)
+
+ _, err = s.fs.OpenFile("/fg2/A Subproject", 0, 0)
+ c.Assert(err, check.IsNil)
+
+ _, err = s.fs.OpenFile("/fg2/A Project", 0, 0)
+ c.Assert(err, check.IsNil)
}
func (s *SiteFSSuite) TestCurrentUserHome(c *check.C) {
fixtureActiveToken = "3kg6k6lzmp9kj5cpkcoxie963cmvjahbt2fod9zru30k1jqdmi"
fixtureAProjectUUID = "zzzzz-j7d0g-v955i6s2oi1cbso"
fixtureThisFilterGroupUUID = "zzzzz-j7d0g-thisfiltergroup"
+ fixtureAFilterGroupTwoUUID = "zzzzz-j7d0g-afiltergrouptwo"
fixtureFooAndBarFilesInDirUUID = "zzzzz-4zz18-foonbarfilesdir"
fixtureFooCollectionName = "zzzzz-4zz18-fy296fx3hot09f7 added sometime"
fixtureFooCollectionPDH = "1f4b0bc7583c2a7f9102c395f4ffc5e3+45"
end
end
- # filter groups need to be limited to those classes mentioned in the filters
- # @object can also be a User object (virtual home project)
- if @object and @object.is_a?(Group) and @object.group_class == "filter"
- if request_filters.length() == 0
- raise ArgumentError.new("Filter group needs to have filters defined")
- end
- request_filters.each do |col, op, val|
- if col.index('.')
- col = col.split('.')[0]
- col = col.capitalize.sub(/s$/,'')
- wanted_klasses << col
- end
- end
- end
-
filter_by_owner = {}
if @object
- # filter groups should not have an owner_uuid filter applied
- if ! @object.is_a?(Group) or (@object.is_a?(Group) and @object.group_class != "filter")
- if params['recursive']
- filter_by_owner[:owner_uuid] = [@object.uuid] + @object.descendant_project_uuids
- else
- filter_by_owner[:owner_uuid] = @object.uuid
- end
+ if params['recursive']
+ filter_by_owner[:owner_uuid] = [@object.uuid] + @object.descendant_project_uuids
+ else
+ filter_by_owner[:owner_uuid] = @object.uuid
end
if params['exclude_home_project']
# shouldn't be anything to do at all.
act_as_system_user do
ActiveRecord::Base.transaction do
- Group.where("group_class != 'project' or group_class is null").each do |g|
- # 1) any group not group_class != project becomes a 'role' (both empty and invalid groups)
+ Group.where("(group_class != 'project' and group_class != 'filter') or group_class is null").each do |g|
+ # 1) any group not group_class != project and != filter becomes a 'role' (both empty and invalid groups)
old_owner = g.owner_uuid
g.owner_uuid = system_user_uuid
g.group_class = 'role'
properties:
filters: [[ "collections.name", "like", "baz%" ], [ "groups.name", "=", "A Subproject" ]]
+afiltergroup2:
+ uuid: zzzzz-j7d0g-afiltergrouptwo
+ 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 without filters
+ group_class: filter
+ properties:
+ filters: []
+
future_project_viewing_group:
uuid: zzzzz-j7d0g-futrprojviewgrp
owner_uuid: zzzzz-tpzed-000000000000000