|
1 | | -{% if is_superuser %} |
2 | | - <form id="usersForm" action="{{ url('/server/privileges') }}"> |
3 | | - {{ get_hidden_inputs(db, table) }} |
| 1 | +<div class="container"> |
| 2 | + {% if is_superuser %} |
| 3 | + <h2> |
| 4 | + {{ get_icon('b_usrcheck') }} |
| 5 | + {{ 'Users having access to "%s"'|trans|format('<a href="' ~ table_url ~ get_common({ |
| 6 | + 'db': db, |
| 7 | + 'table': table |
| 8 | + }, '&') ~ '">' ~ db|escape('html') ~ '.' ~ table|escape('html') ~ '</a>')|raw }} |
| 9 | + </h2> |
4 | 10 |
|
5 | | - <fieldset class="pma-fieldset"> |
6 | | - <legend> |
7 | | - {{ get_icon('b_usrcheck') }} |
8 | | - {{ 'Users having access to "%s"'|trans|format('<a href="' ~ table_url ~ get_common({ |
9 | | - 'db': db, |
10 | | - 'table': table |
11 | | - }, '&') ~ '">' ~ db|escape('html') ~ '.' ~ table|escape('html') ~ '</a>')|raw }} |
12 | | - </legend> |
13 | | - |
14 | | - <div class="table-responsive-md jsresponsive"> |
15 | | - <table class="table table-striped table-hover w-auto"> |
16 | | - <thead> |
17 | | - <tr> |
18 | | - <th></th> |
19 | | - <th>{% trans 'User name' %}</th> |
20 | | - <th>{% trans 'Host name' %}</th> |
21 | | - <th>{% trans 'Type' %}</th> |
22 | | - <th>{% trans 'Privileges' %}</th> |
23 | | - <th>{% trans 'Grant' %}</th> |
24 | | - <th colspan="2">{% trans 'Action' %}</th> |
25 | | - </tr> |
26 | | - </thead> |
27 | | - |
28 | | - <tbody> |
29 | | - {% for privilege in privileges %} |
30 | | - {% set privileges_amount = privilege.privileges|length %} |
| 11 | + <form id="usersForm" action="{{ url('/server/privileges') }}" class="card mb-3"> |
| 12 | + {{ get_hidden_inputs(db, table) }} |
| 13 | + <div class="card-body"> |
| 14 | + <div class="table-responsive-md jsresponsive"> |
| 15 | + <table class="table table-striped table-hover w-auto"> |
| 16 | + <thead> |
31 | 17 | <tr> |
32 | | - <td{% if privileges_amount > 1 %} class="align-middle" rowspan="{{ privileges_amount }}"{% endif %}> |
33 | | - <input type="checkbox" class="checkall" name="selected_usr[]" id="checkbox_sel_users_{{ loop.index0 }}" value=" |
34 | | - {{- privilege.user ~ '&#27;' ~ privilege.host }}"> |
35 | | - </td> |
36 | | - <td{% if privileges_amount > 1 %} class="align-middle" rowspan="{{ privileges_amount }}"{% endif %}> |
37 | | - {% if privilege.user is empty %} |
38 | | - <span class="text-danger">{% trans 'Any' %}</span> |
39 | | - {% else %} |
40 | | - {{ privilege.user }} |
41 | | - {% endif %} |
42 | | - </td> |
43 | | - <td{% if privileges_amount > 1 %} class="align-middle" rowspan="{{ privileges_amount }}"{% endif %}> |
44 | | - {{ privilege.host }} |
45 | | - </td> |
46 | | - {% for priv in privilege.privileges %} |
47 | | - <td> |
48 | | - {% if priv.type == 'g' %} |
49 | | - {% trans 'global' %} |
50 | | - {% elseif priv.type == 'd' %} |
51 | | - {% if priv.database == db|replace({'_': '\\_', '%': '\\%'}) %} |
52 | | - {% trans 'database-specific' %} |
53 | | - {% else %} |
54 | | - {% trans 'wildcard' %}: <code>{{ priv.database }}</code> |
55 | | - {% endif %} |
56 | | - {% elseif priv.type == 't' %} |
57 | | - {% trans 'table-specific' %} |
58 | | - {% elseif priv.type == 'r' %} |
59 | | - {% trans 'routine' %} |
60 | | - {% endif %} |
| 18 | + <th></th> |
| 19 | + <th>{% trans 'User name' %}</th> |
| 20 | + <th>{% trans 'Host name' %}</th> |
| 21 | + <th>{% trans 'Type' %}</th> |
| 22 | + <th>{% trans 'Privileges' %}</th> |
| 23 | + <th>{% trans 'Grant' %}</th> |
| 24 | + <th colspan="2">{% trans 'Action' %}</th> |
| 25 | + </tr> |
| 26 | + </thead> |
| 27 | + |
| 28 | + <tbody> |
| 29 | + {% for privilege in privileges %} |
| 30 | + {% set privileges_amount = privilege.privileges|length %} |
| 31 | + <tr> |
| 32 | + <td{% if privileges_amount > 1 %} class="align-middle" rowspan="{{ privileges_amount }}"{% endif %}> |
| 33 | + <input type="checkbox" class="checkall" name="selected_usr[]" id="checkbox_sel_users_{{ loop.index0 }}" value=" |
| 34 | + {{- privilege.user ~ '&#27;' ~ privilege.host }}"> |
61 | 35 | </td> |
62 | | - <td> |
63 | | - <code> |
64 | | - {% if priv.type == 'r' %} |
65 | | - {{ priv.routine }} |
66 | | - ({{ priv.privileges|join(', ')|upper }}) |
67 | | - {% else %} |
68 | | - {{ priv.privileges|join(', ')|raw }} |
69 | | - {% endif %} |
70 | | - </code> |
| 36 | + <td{% if privileges_amount > 1 %} class="align-middle" rowspan="{{ privileges_amount }}"{% endif %}> |
| 37 | + {% if privilege.user is empty %} |
| 38 | + <span class="text-danger">{% trans 'Any' %}</span> |
| 39 | + {% else %} |
| 40 | + {{ privilege.user }} |
| 41 | + {% endif %} |
71 | 42 | </td> |
72 | | - <td> |
73 | | - {{ priv.has_grant ? 'Yes'|trans : 'No'|trans }} |
| 43 | + <td{% if privileges_amount > 1 %} class="align-middle" rowspan="{{ privileges_amount }}"{% endif %}> |
| 44 | + {{ privilege.host }} |
74 | 45 | </td> |
75 | | - <td> |
76 | | - {% if is_grantuser %} |
77 | | - <a class="edit_user_anchor" href="{{ url('/server/privileges', { |
| 46 | + {% for priv in privilege.privileges %} |
| 47 | + <td> |
| 48 | + {% if priv.type == 'g' %} |
| 49 | + {% trans 'global' %} |
| 50 | + {% elseif priv.type == 'd' %} |
| 51 | + {% if priv.database == db|replace({'_': '\\_', '%': '\\%'}) %} |
| 52 | + {% trans 'database-specific' %} |
| 53 | + {% else %} |
| 54 | + {% trans 'wildcard' %}: <code>{{ priv.database }}</code> |
| 55 | + {% endif %} |
| 56 | + {% elseif priv.type == 't' %} |
| 57 | + {% trans 'table-specific' %} |
| 58 | + {% elseif priv.type == 'r' %} |
| 59 | + {% trans 'routine' %} |
| 60 | + {% endif %} |
| 61 | + </td> |
| 62 | + <td> |
| 63 | + <code> |
| 64 | + {% if priv.type == 'r' %} |
| 65 | + {{ priv.routine }} |
| 66 | + ({{ priv.privileges|join(', ')|upper }}) |
| 67 | + {% else %} |
| 68 | + {{ priv.privileges|join(', ')|raw }} |
| 69 | + {% endif %} |
| 70 | + </code> |
| 71 | + </td> |
| 72 | + <td> |
| 73 | + {{ priv.has_grant ? 'Yes'|trans : 'No'|trans }} |
| 74 | + </td> |
| 75 | + <td> |
| 76 | + {% if is_grantuser %} |
| 77 | + <a class="edit_user_anchor" href="{{ url('/server/privileges', { |
| 78 | + 'username': privilege.user, |
| 79 | + 'hostname': privilege.host, |
| 80 | + 'dbname': priv.database != '*' ? priv.database, |
| 81 | + 'tablename': priv.table is defined and priv.table != '*' ? priv.table, |
| 82 | + 'routinename': priv.routine ?? '' |
| 83 | + }) }}"> |
| 84 | + {{ get_icon('b_usredit', 'Edit privileges'|trans) }} |
| 85 | + </a> |
| 86 | + {% endif %} |
| 87 | + </td> |
| 88 | + <td class="text-center"> |
| 89 | + <a class="export_user_anchor ajax" href="{{ url('/server/privileges', { |
78 | 90 | 'username': privilege.user, |
79 | 91 | 'hostname': privilege.host, |
80 | | - 'dbname': priv.database != '*' ? priv.database, |
81 | | - 'tablename': priv.table is defined and priv.table != '*' ? priv.table, |
82 | | - 'routinename': priv.routine ?? '' |
| 92 | + 'export': true, |
| 93 | + 'initial': '' |
83 | 94 | }) }}"> |
84 | | - {{ get_icon('b_usredit', 'Edit privileges'|trans) }} |
| 95 | + {{ get_icon('b_tblexport', 'Export'|trans) }} |
85 | 96 | </a> |
86 | | - {% endif %} |
87 | | - </td> |
88 | | - <td class="text-center"> |
89 | | - <a class="export_user_anchor ajax" href="{{ url('/server/privileges', { |
90 | | - 'username': privilege.user, |
91 | | - 'hostname': privilege.host, |
92 | | - 'export': true, |
93 | | - 'initial': '' |
94 | | - }) }}"> |
95 | | - {{ get_icon('b_tblexport', 'Export'|trans) }} |
96 | | - </a> |
97 | | - </td> |
98 | | - </tr> |
| 97 | + </td> |
| 98 | + </tr> |
99 | 99 | {% if privileges_amount > 1 %} |
100 | 100 | <tr class="noclick"> |
101 | 101 | {% endif %} |
102 | 102 | {% endfor %} |
103 | | - {% else %} |
104 | | - <tr> |
105 | | - <td colspan="7"> |
106 | | - {% trans 'No user found.' %} |
107 | | - </td> |
108 | | - </tr> |
109 | | - {% endfor %} |
110 | | - </tbody> |
111 | | - </table> |
112 | | - </div> |
| 103 | + {% else %} |
| 104 | + <tr> |
| 105 | + <td colspan="7"> |
| 106 | + {% trans 'No user found.' %} |
| 107 | + </td> |
| 108 | + </tr> |
| 109 | + {% endfor %} |
| 110 | + </tbody> |
| 111 | + </table> |
| 112 | + </div> |
113 | 113 |
|
114 | | - <div class="float-start"> |
115 | | - <img class="selectallarrow" src="{{ image('arrow_' ~ text_dir ~ '.png') }}" alt=" |
| 114 | + <div> |
| 115 | + <img class="selectallarrow" src="{{ image('arrow_' ~ text_dir ~ '.png') }}" alt=" |
116 | 116 | {%- trans 'With selected:' %}" width="38" height="22"> |
117 | | - <input type="checkbox" id="usersForm_checkall" class="checkall_box" title="{% trans 'Check all' %}"> |
118 | | - <label for="usersForm_checkall">{% trans 'Check all' %}</label> |
119 | | - <em class="with-selected">{% trans 'With selected:' %}</em> |
120 | | - <button class="btn btn-link mult_submit" type="submit" name="submit_mult" value="export" title="{% trans 'Export' %}"> |
121 | | - {{ get_icon('b_tblexport', 'Export'|trans) }} |
122 | | - </button> |
| 117 | + <input type="checkbox" id="usersForm_checkall" class="checkall_box" title="{% trans 'Check all' %}"> |
| 118 | + <label for="usersForm_checkall">{% trans 'Check all' %}</label> |
| 119 | + <em class="with-selected">{% trans 'With selected:' %}</em> |
| 120 | + <button class="btn btn-link mult_submit" type="submit" name="submit_mult" value="export" title="{% trans 'Export' %}"> |
| 121 | + {{ get_icon('b_tblexport', 'Export'|trans) }} |
| 122 | + </button> |
| 123 | + </div> |
123 | 124 | </div> |
124 | | - </fieldset> |
125 | | - </form> |
126 | | -{% else %} |
127 | | - {{ 'Not enough privilege to view users.'|trans|error }} |
128 | | -{% endif %} |
| 125 | + </form> |
| 126 | + {% else %} |
| 127 | + {{ 'Not enough privilege to view users.'|trans|error }} |
| 128 | + {% endif %} |
129 | 129 |
|
130 | | -{% if is_createuser %} |
131 | | - <div class="row"> |
132 | | - <div class="col-12"> |
133 | | - <fieldset class="pma-fieldset" id="fieldset_add_user"> |
134 | | - <legend>{% trans %}New{% context %}Create new user{% endtrans %}</legend> |
135 | | - <a id="add_user_anchor" href="{{ url('/server/privileges', { |
136 | | - 'adduser': true, |
137 | | - 'dbname': db, |
138 | | - 'tablename': table |
139 | | - }) }}"> |
140 | | - {{ get_icon('b_usradd', 'Add user account'|trans) }} |
141 | | - </a> |
142 | | - </fieldset> |
| 130 | + {% if is_createuser %} |
| 131 | + <div> |
| 132 | + <a class="btn btn-primary" id="add_user_anchor" href="{{ url('/server/privileges', { |
| 133 | + 'adduser': true, |
| 134 | + 'dbname': db, |
| 135 | + 'tablename': table |
| 136 | + }) }}"> |
| 137 | + {{ get_icon('b_usradd', 'Add user account'|trans) }} |
| 138 | + </a> |
143 | 139 | </div> |
144 | | - </div> |
145 | | -{% endif %} |
| 140 | + {% endif %} |
| 141 | +</div> |
0 commit comments