10666: Merge branch 'master' into 10666-report-version
[arvados.git] / apps / workbench / app / controllers / user_agreements_controller.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 class UserAgreementsController < ApplicationController
6   skip_before_filter :check_user_agreements
7   skip_before_filter :find_object_by_uuid
8   skip_before_filter :check_user_profile
9
10   def index
11     if unsigned_user_agreements.empty?
12       redirect_to(params[:return_to] || :back)
13     end
14   end
15
16   def model_class
17     Collection
18   end
19
20   def sign
21     params[:checked].each do |checked|
22       if (r = CollectionsHelper.match_uuid_with_optional_filepath(checked))
23         UserAgreement.sign uuid: r[1]
24       end
25     end
26     current_user.activate
27     redirect_to(params[:return_to] || :back)
28   end
29 end