<%
# 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 <http://www.gnu.org/licenses/>.
%>

<% provide :page_title do %>
  <%= t('titles.unauthorized_action', %{Unauthorized}) %>
<% end %>
<% @show_left_side = false %>
<% @show_embedded_chat = false %>
<% add_body_class 'full-width' %>
<div id="unauthorized_message" class="ic-Error-page">
    <% if @needs_cookies %>
      <img class="ic-Error-img" role="presentation" alt="" aria-hidden="true" src="/images/500_pageerror.svg">
      <h1><%= t('headings.needs_cookies', %{Cookies Required}) %></h1>
    <% elsif @unauthorized_reason == :unpublished %>
      <img class="ic-Error-img" role="presentation" alt="" aria-hidden="true" src="/images/401_unpublished.svg">
      <h1><%= t('headings.unpublished', %{Not Yet Available}) %></h1>
    <% else %>
      <img class="ic-Error-img" role="presentation" alt="" aria-hidden="true" src="/images/401_permissions.svg">
      <h1><%= t("Access Denied") %></h1>
    <% end %>
    <% if @unauthorized_message %>
      <p><%= @unauthorized_message %></p>
    <% elsif @needs_cookies %>
      <p><%= t('Please adjust your security preferences before continuing.') %></p>
    <% elsif @files_domain %>
      <p><%= t('needs_login', %{Access to this page is limited to authorized users.  You do not currently have permission to view this page.}) %></p>
    <% elsif @context %>
      <p>
        <% if @context.try_rescue(:is_public) %>
          <%= mt 'public_course', 'This page is part of the content for the course, **%{course}**.', :course => @context.name %>
        <% end %>
        <%= t("You don't have access to view this resource.") %>
      </p>
      <% if send_broken_content! %>
        <p><%= I18n.t("We've let your instructor know to review this link as soon as possible.") %></p>
      <% end %>
    <% end %>
</div>
