<!DOCTYPE html>
<html>
  <head>
    <title>Open RBF 2.0</title>
    <%= csrf_meta_tags %>

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <% if log_rocket_token = ENV["LOG_ROCKET_TOKEN"] %>
      <script src="https://cdn.lr-ingest.io/LogRocket.min.js" crossorigin="anonymous"></script>
      <script>
       const token = "<%= log_rocket_token %>";
       window.LogRocket && window.LogRocket.init(token);</script>
    <% end %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
  </head>

  <body class="private container">
    <%= render "layouts/header" %>
    <%= render "layouts/notifications" %>

    <div >
      <%= yield %>
    </div>
    <% if Scorpio.can_impersonate?(true_user || current_user) %>
      <h5>Sign in as</h5>
      <details>
        <div>
          <ul>
            <% User.find_each do |user| %>
              <li><%= link_to user.impersonate_label, impersonate_user_path(user), method: :post %></li>
            <% end %>
          </ul>
        </div>
      </details>
    <% end %>
  </body>
</html>

<!DOCTYPE html>
<html>
  <head>
    <title>Open RBF 2.0</title>
    <%= csrf_meta_tags %>

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <% if log_rocket_token = ENV["LOG_ROCKET_TOKEN"] %>
      <script src="https://cdn.lr-ingest.io/LogRocket.min.js" crossorigin="anonymous"></script>
      <script>
       const token = "<%= log_rocket_token %>";
       window.LogRocket && window.LogRocket.init(token);</script>
    <% end %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
  </head>

  <body class="private container">
    <%= render "layouts/header" %>
    <%= render "layouts/notifications" %>

    <div >
      <%= yield %>
    </div>
    <% if Scorpio.can_impersonate?(true_user || current_user) %>
      <h5>Sign in as</h5>
      <details>
        <div>
          <ul>
            <% User.includes(program: { project_anchor: :projects }).order(:email).each do |user| %>
              <li><%= link_to user.impersonate_label, impersonate_user_path(user), method: :post %></li>
            <% end %>
          </ul>
        </div>
      </details>
    <% end %>
  </body>
</html>

Improve perf to impersonnate users
Improve perf to impersonnate users
