<% # 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 %><%= join_title context_user_name(@context, @user), @context.name %><% end %> <% provide :right_side do %>
<% if can_do(@membership, @current_user, :read_grades) && @membership.is_a?(StudentEnrollment) %> <%= t "Student Grades" %> <% end %> <% if @domain_root_account.enable_user_notes and can_do(@user, @current_user, :read_user_notes) %> <%= t "Faculty Journal" %> <% end %> <% if @context.is_a?(Course)%> <% if @context.user_is_instructor?(@user) && can_do(@user, @current_user, :read_reports) && can_do(@context, @current_user, :view_all_grades) %> <%= t 'Student Interactions Report' %> <% elsif @context.user_has_been_student?(@user) && @context.user_is_instructor?(@current_user) && can_do(@context, @current_user, :read_reports) && can_do(@context, @current_user, :view_all_grades) %> <%= t 'Interactions Report' %> <% end %> <% end %> <% if can_do(@context, @current_user, :read_reports) %> <%= t "Access Report" %> <% end %> <% if @context.is_a?(Course) && @context.has_outcomes? && can_do(@context, @current_user, :manage) %> <%= t "Outcomes Report" %> <% end %> <% if @user.grants_right?(@current_user, :view_statistics) %> <%= t('links.user_account_details', %{User Account Details}) %> <% end %> <% roster_user_custom_links(@user).each do |link| %> <%= link[:text] %> <% end %> <% if @user.grants_right?(@current_user, :generate_observer_pairing_code) && @user.has_student_enrollment? && @domain_root_account.self_registration? %>
<% end %>
<% end %> <%= render :partial => 'shared/profile' %> <% can_manage_students = can_do(@context, @current_user, :manage_students) %> <% can_manage_admins = can_do(@context, @current_user, :manage_admin_users) %> <% if !@context.is_a?(Group) && (can_manage_students || can_manage_admins) %>
<% if @context.is_a?(Course) %>

<%= t('legends.memberships', %{Membership(s)}) %>

<% @enrollments.sort_by(&:id).each do |enrollment| %> <% end %> <% end %> <% if @context.is_a?(Course) && can_do(@context, @current_user, :manage_admin_users) %> <% end %>
"><%= enrollment.try_rescue(:course_section).try_rescue(:display_name) || enrollment.short_name %> <%= t 'enrolled_as', "Enrolled as a %{enrollment_type}", :enrollment_type => enrollment.readable_type %>
<%= t "Created %{created}", created: datetime_string(enrollment.created_at) %> <% if enrollment.is_a?(ObserverEnrollment) %>
<%= t 'enrollment_linked_to', "Linked to *%{linked_user}*", :linked_user => context_user_name(@context, enrollment.associated_user), :wrapper => '\1' %> <% end %>
<%= t 'completed_enrollment', "Completed *%{completed_at}*", :completed_at => datetime_string(enrollment.completed_at), :wrapper => '\1' %>
<% if enrollment.admin? ? (can_manage_admins && enrollment.user_id != @current_user.id) : can_manage_students %> <% unless @context.completed? %> <% end %>
<% if enrollment.defined_by_sis? && !@context.grants_any_right?(@current_user, session, :manage_account_settings, :manage_sis) %> <%= t('links.cant_delete', %{Can't Delete}) %> <% else %> <%= t('links.delete_enrollment', %{Delete}) %> <% end %>
<%= before_label('user_privileges', %{Privileges}) %>
<% if @context.is_a?(Course) && can_do(@context, @current_user, :manage_admin_users) %>
<% end %>
<%= render :partial => 'courses/link_enrollment' %> <% end %> <%= render :partial => 'users/logins' %>
<% end %>