Fix 2.4.2 upgrade notes formatting refs #19330
[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_action :check_user_agreements
7   skip_before_action :find_object_by_uuid
8   skip_before_action :check_user_profile
9
10   def index
11     if unsigned_user_agreements.empty?
12       if params[:return_to]
13         redirect_to(params[:return_to])
14       else
15         redirect_back(fallback_location: root_path)
16       end
17     end
18   end
19
20   def model_class
21     Collection
22   end
23
24   def sign
25     params[:checked].each do |checked|
26       if (r = CollectionsHelper.match_uuid_with_optional_filepath(checked))
27         UserAgreement.sign uuid: r[1]
28       end
29     end
30     current_user.activate
31     if params[:return_to]
32       redirect_to(params[:return_to])
33     else
34       redirect_back(fallback_location: root_path)
35     end
36   end
37 end