federated_attributes.mustache 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <%
  2. # Copyright (C) 2016 - present Instructure, Inc.
  3. #
  4. # This file is part of Canvas.
  5. #
  6. # Canvas is free software: you can redistribute it and/or modify it under
  7. # the terms of the GNU Affero General Public License as published by the Free
  8. # Software Foundation, version 3 of the License.
  9. #
  10. # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
  11. # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  12. # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
  13. # details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License along
  16. # with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %>
  18. <div class="federated_attributes">
  19. <h4><%= t 'Federated Attributes' %></h4>
  20. <p><%= t <<-TEXT
  21. Federated attributes are information sent from your authentication provider that can be used
  22. to automatically update corresponding information for users in Canvas each time they log in.
  23. TEXT
  24. %></p>
  25. <table class="ic-Table" style="<%= hidden unless aac.federated_attributes.present? %>">
  26. <thead>
  27. <th scope="col"><%= t 'Canvas Attribute' %></th>
  28. <th scope="col"><%= t 'Provider Attribute' %></th>
  29. <th scope="col" style="<%= hidden unless aac.jit_provisioning? %>" class="provisioning_only_column">
  30. <%= t 'Provisioning Only' %>
  31. <a
  32. class="icon-info"
  33. tabindex="0"
  34. data-tooltip='{"tooltipClass":"popover popover-padded", "position":"right"}'
  35. title= "<%= t <<-TEXT
  36. If an attribute is marked as provisioning only, then it will only be used when Just in Time
  37. Provisioning creates a new user, and will not be kept up to date each time the user logs in.
  38. TEXT
  39. %>"
  40. >
  41. </a>
  42. </th>
  43. <td scope="col">&nbsp;</td>
  44. </thead>
  45. <tbody>
  46. <% aac.federated_attributes.each do |(canvas_attribute, provider_attribute)| %>
  47. <tr>
  48. <th scope="row" class="canvas_attribute"><span class="canvas_attribute_name"><%= canvas_attribute %></span></th>
  49. <td><label class="ic-Label screenreader-only" for="aacfa_<%= canvas_attribute %>_attribute_<%= presenter.id_suffix(aac) %>"><%= t 'Provider Attribute' %></label>
  50. <%= presenter.federated_provider_attribute(aac, canvas_attribute, provider_attribute['attribute']) %>
  51. </td>
  52. <td class="provisioning_only_column<%= ' federated_attributes_none' unless aac.jit_provisioning? %>">
  53. <label class="ic-Label screenreader-only" for="aacfa_<%= canvas_attribute %>_provisioning_only_<%= presenter.id_suffix(aac) %>"><%= t 'Provisioning Only' %></label>
  54. <input type="checkbox" id="aacfa_<%= canvas_attribute %>_provisioning_only_<%= presenter.id_suffix(aac) %>" name="authentication_provider[federated_attributes][<%= canvas_attribute %>][provisioning_only]" <%= 'checked="checked"'.html_safe if provider_attribute['provisioning_only'] %>/>
  55. </td>
  56. <td>
  57. <button type="button" class="Button Button--icon-action remove_federated_attribute"><i class="icon-trash"></i></button>
  58. </td>
  59. </tr>
  60. <% end %>
  61. <tr style="display: none" class="attribute_template" data-idsuffix="<%= presenter.id_suffix(aac) %>">
  62. <th scope="row" class="canvas_attribute">
  63. <span class="canvas_attribute_name"></span>
  64. </th>
  65. <td class="provider_attribute_column">
  66. <label class="ic-Label screenreader-only"><%= t 'Provider Attribute' %></label>
  67. <%= presenter.federated_provider_attribute(aac) %>
  68. </td>
  69. <td class="provisioning_only_column<%= ' federated_attributes_none' unless aac.jit_provisioning? %>">
  70. <label class="ic-Label screenreader-only"><%= t 'Provisioning Only' %></label>
  71. <input type="checkbox" />
  72. </td>
  73. <td>
  74. <button type="button" class="Button Button--icon-action remove_federated_attribute"><i class="icon-trash"></i></button>
  75. </td>
  76. </tr>
  77. </tbody>
  78. </table>
  79. <% attrs = presenter.available_federated_attributes(aac) %>
  80. <div class="<%= attrs.empty? ? 'federated_attributes_none' : 'add_attribute' %>">
  81. <label class="ic-Label screenreader-only" for="aacfa_add_attribute_<%= presenter.id_suffix(aac) %>"><%= t 'Choose attribute to add' %></label>
  82. <select id="aacfa_add_attribute_<%= presenter.id_suffix(aac) %>" class="ic-Input canvas_attribute federated_attributes_select">
  83. <% attrs.each do |attr| %>
  84. <option><%= attr %></option>
  85. <% end %>
  86. </select>
  87. <button class="Button Button--primary addAttribute--Button add_federated_attribute_button">
  88. <i class="icon-plus"></i>
  89. <span aria-hidden="true"><%= t 'Attribute' %></span>
  90. </button>
  91. </div>
  92. <% if aac.federated_attributes.empty? %>
  93. <input type='hidden' name='authentication_provider[federated_attributes]' value='' class='no_federated_attributes'>
  94. <% end %>
  95. </div>