users_overview.twig 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <form name="usersForm" id="usersForm" action="{{ url('/server/privileges') }}" method="post">
  2. {{ get_hidden_inputs() }}
  3. <div class="table-responsive">
  4. <table id="userRightsTable" class="table table-light table-striped table-hover w-auto">
  5. <thead class="thead-light">
  6. <tr>
  7. <th></th>
  8. <th scope="col">{% trans 'User name' %}</th>
  9. <th scope="col">{% trans 'Host name' %}</th>
  10. <th scope="col">{% trans 'Password' %}</th>
  11. <th scope="col">
  12. {% trans 'Global privileges' %}
  13. {{ show_hint('Note: MySQL privilege names are expressed in English.') }}
  14. </th>
  15. {% if menus_work %}
  16. <th scope="col">{% trans 'User group' %}</th>
  17. {% endif %}
  18. <th scope="col">{% trans 'Grant' %}</th>
  19. <th scope="col" colspan="{{ user_group_count > 0 ? '3' : '2' }}">{% trans 'Action' %}</th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. {% for host in hosts %}
  24. <tr>
  25. <td>
  26. <input type="checkbox" class="checkall" id="checkbox_sel_users_{{ loop.index }}" value="
  27. {{- host.user ~ '&amp;#27;' ~ host.host }}" name="selected_usr[]">
  28. </td>
  29. <td>
  30. <label for="checkbox_sel_users_{{ loop.index }}">
  31. {% if host.user is empty %}
  32. <span class="text-danger">{% trans 'Any' %}</span>
  33. {% else %}
  34. <a class="edit_user_anchor" href="{{ url('/server/privileges', {
  35. 'username': host.user,
  36. 'hostname': host.host,
  37. 'dbname': '',
  38. 'tablename': '',
  39. 'routinename': '',
  40. }) }}">
  41. {{ host.user }}
  42. </a>
  43. {% endif %}
  44. </label>
  45. </td>
  46. <td>{{ host.host }}</td>
  47. <td>
  48. {% if host.has_password %}
  49. {% trans 'Yes' %}
  50. {% else %}
  51. <span class="text-danger">{% trans 'No' %}</span>
  52. {% endif %}
  53. {{ not host.has_select_priv ? show_hint('The selected user was not found in the privilege table.'|trans) }}
  54. </td>
  55. <td>
  56. <code>{{ host.privileges|join(', ')|raw }}</code>
  57. </td>
  58. {% if menus_work %}
  59. <td class="usrGroup">{{ host.group }}</td>
  60. {% endif %}
  61. <td>{{ host.has_grant ? 'Yes'|trans : 'No'|trans }}</td>
  62. {% if is_grantuser %}
  63. <td class="text-center">
  64. <a class="edit_user_anchor" href="{{ url('/server/privileges', {
  65. 'username': host.user,
  66. 'hostname': host.host,
  67. 'dbname': '',
  68. 'tablename': '',
  69. 'routinename': '',
  70. }) }}">
  71. {{ get_icon('b_usredit', 'Edit privileges'|trans) }}
  72. </a>
  73. </td>
  74. {% endif %}
  75. {% if menus_work and user_group_count > 0 %}
  76. <td class="text-center">
  77. {% if host.user is not empty %}
  78. <a class="edit_user_group_anchor ajax" href="{{ url('/server/privileges', {'username': host.user}) }}">
  79. {{ get_icon('b_usrlist', 'Edit user group'|trans) }}
  80. </a>
  81. {% endif %}
  82. </td>
  83. {% endif %}
  84. <td class="text-center">
  85. <a class="export_user_anchor ajax" href="{{ url('/server/privileges', {
  86. 'username': host.user,
  87. 'hostname': host.host,
  88. 'initial': initial,
  89. 'export': true,
  90. }) }}">
  91. {{ get_icon('b_tblexport', 'Export'|trans) }}
  92. </a>
  93. </td>
  94. </tr>
  95. {% endfor %}
  96. </tbody>
  97. </table>
  98. </div>
  99. <div class="floatleft row">
  100. <div class="col-12">
  101. <img class="selectallarrow" width="38" height="22" src="
  102. {{- theme_image_path }}arrow_{{ text_dir }}.png" alt="{% trans 'With selected:' %}">
  103. <input type="checkbox" id="usersForm_checkall" class="checkall_box" title="{% trans 'Check all' %}">
  104. <label for="usersForm_checkall">{% trans 'Check all' %}</label>
  105. <em class="with-selected">{% trans 'With selected:' %}</em>
  106. <button class="btn btn-link mult_submit" type="submit" name="submit_mult" value="export" title="{% trans 'Export' %}">
  107. {{ get_icon('b_tblexport', 'Export'|trans) }}
  108. </button>
  109. <input type="hidden" name="initial" value="{{ initial }}">
  110. </div>
  111. </div>
  112. <div class="clearfloat"></div>
  113. {% if is_createuser %}
  114. <div class="card mb-3">
  115. <div class="card-header">{% trans %}New{% context %}Create new user{% endtrans %}</div>
  116. <div class="card-body">
  117. <a id="add_user_anchor" href="{{ url('/server/privileges', {'adduser': true}) }}">
  118. {{ get_icon('b_usradd', 'Add user account'|trans) }}
  119. </a>
  120. </div>
  121. </div>
  122. {% endif %}
  123. <div id="deleteUserCard" class="card mb-3">
  124. <div class="card-header">{{ get_icon('b_usrdrop', 'Remove selected user accounts'|trans) }}</div>
  125. <div class="card-body">
  126. <p class="card-text">{% trans 'Revoke all active privileges from the users and delete them afterwards.' %}</p>
  127. <div class="form-check">
  128. <input class="form-check-input" type="checkbox" id="dropUsersDbCheckbox" name="drop_users_db">
  129. <label class="form-check-label" for="dropUsersDbCheckbox">
  130. {% trans 'Drop the databases that have the same names as the users.' %}
  131. </label>
  132. </div>
  133. </div>
  134. <div class="card-footer text-right">
  135. <input type="hidden" name="mode" value="2">
  136. <input id="buttonGo" class="btn btn-primary ajax" type="submit" name="delete" value="{% trans 'Go' %}">
  137. </div>
  138. </div>
  139. </form>