X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b588c254853ab654a685669c36b21e05154b6571..9e3bb9b984ff700fc3455f87437a8f1ac5841f0e:/services/api/app/controllers/arvados/v1/user_agreements_controller.rb diff --git a/services/api/app/controllers/arvados/v1/user_agreements_controller.rb b/services/api/app/controllers/arvados/v1/user_agreements_controller.rb index ac74f3d8d2..4ad959e86a 100644 --- a/services/api/app/controllers/arvados/v1/user_agreements_controller.rb +++ b/services/api/app/controllers/arvados/v1/user_agreements_controller.rb @@ -1,21 +1,33 @@ class Arvados::V1::UserAgreementsController < ApplicationController before_filter :admin_required, except: [:index, :sign, :signatures] + skip_before_filter :find_object_by_uuid, only: [:sign, :signatures] + skip_before_filter :render_404_if_no_object, only: [:sign, :signatures] def model_class Link end + def table_name + 'links' + end + def index - current_user_uuid = current_user.uuid - act_as_system_user do - uuids = Link.where(owner_uuid: system_user_uuid, - link_class: 'signature', - name: 'require', - tail_kind: 'arvados#user', - tail_uuid: system_user_uuid, - head_kind: 'arvados#collection'). - collect &:head_uuid - @objects = Collection.where('uuid in (?)', uuids) + if not current_user.is_invited + # New users cannot see user agreements until/unless invited to + # use this installation. + @objects = [] + else + current_user_uuid = current_user.uuid + act_as_system_user do + uuids = Link.where(owner_uuid: system_user_uuid, + link_class: 'signature', + name: 'require', + tail_kind: 'arvados#user', + tail_uuid: system_user_uuid, + head_kind: 'arvados#collection'). + collect &:head_uuid + @objects = Collection.where('uuid in (?)', uuids) + end end @response_resource_name = 'collection' super @@ -44,7 +56,7 @@ class Arvados::V1::UserAgreementsController < ApplicationController tail_kind: 'arvados#user', tail_uuid: current_user_uuid, head_kind: 'arvados#collection', - head_uuid: params[:id]) + head_uuid: params[:uuid]) end show end