Skip to content

Commit

Permalink
EZEE-3213: Added verification if the user has section/view permission (
Browse files Browse the repository at this point in the history
…#2016)

* EZEE-3213: Added verification if the user has section/view permission

* verifications permission changed to isGranted

* CS, changed variable name

Co-authored-by: Mateusz Dębiński <mateusz.debinski@ibexa.co>
  • Loading branch information
mateuszdebinski and Mateusz Dębiński authored Nov 29, 2021
1 parent da6e3d8 commit 88b20fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/bundle/Controller/TrashController.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public function listAction(Request $request): Response
'can_delete' => $this->isGranted(new Attribute('content', 'remove')),
'can_restore' => $this->isGranted(new Attribute('content', 'restore')),
'can_cleantrash' => $this->isGranted(new Attribute('content', 'cleantrash')),
'can_view_section' => $this->isGranted(new Attribute('section', 'view')),
'trash_items' => $trashItemsList,
'pager' => $pagerfanta,
'form_trash_item_restore' => $trashItemRestoreForm->createView(),
Expand Down
29 changes: 17 additions & 12 deletions src/bundle/Resources/views/themes/admin/trash/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

{% block content %}
{% set trashSearchParams = app.request.get('trash_search') %}

<div class="row align-items-stretch ez-main-row">
{% block left_sidebar %}
{{ parent() }}
Expand All @@ -35,9 +34,11 @@
{{ form_widget(form_search.content_type, {
'attr': {'class': 'ez-trash-search-form__item ez-trash-search-form__item--auto-send'}
}) }}
{{ form_widget(form_search.section, {
'attr': {'class': 'ez-trash-search-form__item ez-trash-search-form__item--auto-send'}
}) }}
{% if can_view_section %}
{{ form_widget(form_search.section, {
'attr': {'class': 'ez-trash-search-form__item ez-trash-search-form__item--auto-send'}
}) }}
{% endif %}

<div class='ez-trash-search-form__item ez-trash-search-form__item--trashed'>
{{ form_widget(form_search.trashed, {
Expand Down Expand Up @@ -159,13 +160,15 @@
data-direction="{{ sort_directions.creator }}"
>{{ 'trash.creator'|trans|desc('Creator') }}</span>
</th>
<th class="ez-table__header-cell">
<span
class="ez-table__sort-column ez-table__sort-column--section"
data-field="section"
data-direction="{{ sort_directions.section }}"
>{{ 'trash.section'|trans|desc('Section') }}</span>
</th>
{% if can_view_section %}
<th class="ez-table__header-cell">
<span
class="ez-table__sort-column ez-table__sort-column--section"
data-field="section"
data-direction="{{ sort_directions.section }}"
>{{ 'trash.section'|trans|desc('Section') }}</span>
</th>
{% endif %}
<th class="ez-table__header-cell">
{{ 'trash.original_location'|trans|desc('Original Location') }}
</th>
Expand Down Expand Up @@ -215,7 +218,9 @@
'trash.item.deleted_user'|trans|desc('Deleted user')
}}
</td>
<td class="ez-table__cell">{{ trash_item.location.contentInfo.section.name }}</td>
{% if can_view_section %}
<td class="ez-table__cell">{{ trash_item.location.contentInfo.section.name }}</td>
{% endif %}
<td class="ez-table__cell">
{% if not is_parent_in_trash %}
{% include '@ezdesign/ui/location_path.html.twig' with {'locations': trash_item.ancestors, 'link_last_element': true} %}
Expand Down

0 comments on commit 88b20fe

Please sign in to comment.