]> git.agnieray.net Git - galette.git/commitdiff
Fix batch actions JS for group managers; fixes #1702 (#306)
authorGuillaume AGNIERAY <107203963+gagnieray@users.noreply.github.com>
Thu, 5 Oct 2023 12:42:19 +0000 (14:42 +0200)
committerGitHub <noreply@github.com>
Thu, 5 Oct 2023 12:42:19 +0000 (14:42 +0200)
* Fix batch actions JS for group managers

fixes #1702

* Ensure only admin and staff members can access delete code

---------

Co-authored-by: Johan Cwiklinski <johan@x-tnd.be>
galette/templates/default/elements/list.html.twig

index 49fc111abb318536f0009d3ff20adcb463ab91d9..9b853dc1b29e72036ceb27de8fdfc420cbbe7e25 100644 (file)
         $(function(){
     {% if batch is defined and batch_actions is defined and batch_actions|length > 0 %}
             var _init_page = function(res){
-        {% if login.isAdmin() or login.isStaff() %}
+        {% if login.isAdmin() or login.isStaff() or login.isGroupManager() %}
                 {# Use of Javascript to draw specific elements that are not relevant if JS is inactive #}
                 var _checklinks = '<a href="#" class="checkall ui blue tertiary button">{{ _T("(Un)Check all")|e('js') }}</a>' +
                     ' | <a href="#" class="checkinvert ui blue tertiary button">{{ _T("Invert selection")|e('js') }}</a> | ';
                                 _form.append($('<input id="directdownload" type="hidden" name="' + value + '" value="true"/>'));
                             _form.submit();
                             $('#directdownload').remove();
+            {% if login.isAdmin() or login.isStaff() %}
                         // Handle delete.
                         } else if (value == 'delete') {
                             {% include "elements/js/removal.js.twig" with {
                                 loader: "button",
                                 loader_parent: ".batch-select-action"
                             } %}
+            {% endif %}
                         }
                         // Handle other custom list actions.
-                {% if batch_selection is defined %}
+            {% if batch_selection is defined %}
                         {% block batch_selection %}{% endblock %}
-                {% endif %}
+            {% endif %}
                     }
                 });
                 $('.batch-selection').after({% if _legend_block is not empty %}_legendlink{% else %}_checklinks{% endif %});