1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
5 class Arvados::V1::UserAgreementsController < ApplicationController
6 before_action :admin_required, except: [:index, :sign, :signatures]
7 skip_before_action :find_object_by_uuid, only: [:sign, :signatures]
8 skip_before_action :render_404_if_no_object, only: [:sign, :signatures]
19 if not current_user.is_invited
20 # New users cannot see user agreements until/unless invited to
21 # use this installation.
25 uuids = Link.where("owner_uuid = ? and link_class = ? and name = ? and tail_uuid = ? and head_uuid like ?",
30 Collection.uuid_like_pattern).
32 @objects = Collection.where('uuid in (?)', uuids)
35 @response_resource_name = 'collection'
40 current_user_uuid = (current_user.andand.is_admin && params[:uuid]) ||
43 @objects = Link.where("owner_uuid = ? and link_class = ? and name = ? and tail_uuid = ? and head_uuid like ?",
48 Collection.uuid_like_pattern)
50 @response_resource_name = 'link'
55 current_user_uuid = current_user.uuid
57 @object = Link.create(link_class: 'signature',
59 tail_uuid: current_user_uuid,
60 head_uuid: params[:uuid])
83 raise ArgumentError.new \
84 "Manage user agreements via Collections and Links instead."