1 class Arvados::V1::GroupsController < ApplicationController
3 def self._contents_requires_parameters
4 _index_requires_parameters.
7 type: 'boolean', required: false, default: false
16 # Trick apply_where_limit_order_params into applying suitable
17 # per-table values. *_all are the real ones we'll apply to the
24 Job, PipelineInstance, PipelineTemplate,
26 Human, Specimen, Trait].each do |klass|
27 @objects = klass.readable_by(*@read_users)
28 cond_sql = "#{klass.table_name}.owner_uuid = ?"
29 cond_params = [@object.uuid]
30 if params[:include_linked]
31 cond_sql += " OR #{klass.table_name}.uuid IN (SELECT head_uuid FROM links WHERE link_class=#{klass.sanitize 'name'} AND links.tail_uuid=#{klass.sanitize @object.uuid})"
33 @objects = @objects.where(cond_sql, *cond_params).order("#{klass.table_name}.uuid")
34 @limit = limit_all - all_objects.count
35 apply_where_limit_order_params
36 items_available = @objects.
37 except(:limit).except(:offset).
38 count(:id, distinct: true)
39 all_available += items_available
40 @offset = [@offset - items_available, 0].max
42 all_objects += @objects.to_a
44 @objects = all_objects || []
45 @links = Link.where('link_class=? and tail_uuid=?'\
46 ' and head_uuid in (?)',
49 @objects.collect(&:uuid))
51 :kind => "arvados#objectList",
54 :links => @links.as_api_response(nil),
55 :offset => offset_all,
57 :items_available => all_available,
58 :items => @objects.as_api_response(nil)
60 render json: @object_list