<% # Copyright (C) 2011 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see . %> <% provide :page_title do %><%= t('titles.merge_users', 'Merge User Accounts') %><% end %>
<% if @other_user %>

<%= t('titles.really_merge', 'Really Merge User Accounts?') %>

<%= t('no_merge_undo', "This process cannot be undone, so please make sure you're certain before you continue.") %>

<%= t('merge_result_explanation', "Are you sure you want to merge the account, %{source_user_name} (%{source_user_email}) into this account, %{target_user_name} (%{target_user_email})? This process will have the following end result:", :source_user_name => @user.name, :source_user_email => @user.email, :target_user_name => @other_user.name, :target_user_email => @other_user.email) %> <%= render :partial => 'merge_results', :locals => {:user => @user, :other_user => @other_user} %>

<%= form_tag user_merge_path(@user, :new_user_id => @other_user.id), :method => :post do %>
<%= t('#buttons.cancel', 'Cancel') %>
<% end %> <% else %>

<%= t('titles.merge_users', 'Merge User Accounts') %>

<% if @pending_other_user %> <%= t('merge_result_explanation_again', "You've selected to merge the user, %{user_name} (%{user_email}) into the account, %{pending_other_user_name} (%{pending_other_user_email}). This process will have the following end result:", :user_name => @user.name, :user_email => @user.email, :pending_other_user_name => @pending_other_user.name, :pending_other_user_email => @pending_other_user.email) %> <%= render :partial => 'merge_results', :locals => {:user => @user, :other_user => @pending_other_user} %> <%= t('prepare_to_merge', "Prepare to Merge Users") %> <%= t('switch_user_positions', "Switch User Positions") %> <%= t('merge_somone_else', 'Merge Someone Else With %{user_name}', :user_name => @user.name) %> <%= t('merge_somone_else', 'Merge Someone Else With %{user_name}', :user_name => @pending_other_user.name) %> <% else %>

<%= t('merge_user_initial_instructions', "You've selected to merge the user, %{user_name} (%{user_email}) with another account. You can search for the user you'd like to merge with this user using the form below.", :user_name => @user.name, :user_email => @user.email) %>

<%= t('titles.find_user', 'Find a User') %>

<% accounts = @current_user.associated_accounts.shard(Shard.current).to_a accounts << @domain_root_account if @domain_root_account && !accounts.include?(@domain_root_account) accounts = accounts.sort_by(&:name).uniq.select { |a| a.grants_any_right?(@current_user, session, :manage_user_logins, :read_roster) } %> <% if accounts.empty? %> <%= t('no_permission', "You don't have permission to search any accounts") %> <% else %>
<% accounts.each do |account| %> <% end %>
<% end %>

<%= t('titles.enter_user_id', 'Or Enter a User ID') %>

<%= form_tag user_admin_merge_url(@user.id), {:method => :get} do %> <% end %>
<% js_bundle 'users_admin_merge' %> <% end %> <% end %>