Skip to content

Commit

Permalink
IBX-8254: Added check if relation is accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Dębiński committed May 7, 2024
1 parent 6fb2d91 commit 49f1684
Showing 1 changed file with 40 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,47 @@
{% if relations is not empty %}
{% for relation in relations %}
{% set body_row_cols = [] %}
{% set destination = relation.destinationContentInfo %}

{% set col_raw %}
{% if destination.mainLocationId is not null %}
<a href="{{ path('ibexa.content.view', { 'contentId': destination.id, 'locationId': relation.resolvedDestinationLocation.id }) }}">
{% if relation.isAccessible %}
{% set destination = relation.destinationContentInfo %}

{% set col_raw %}
{% if destination.mainLocationId is not null %}
<a href="{{ path('ibexa.content.view', { 'contentId': destination.id, 'locationId': relation.resolvedDestinationLocation.id }) }}">
{{ ibexa_content_name(destination) }}
</a>
{% else %}
{{ ibexa_content_name(destination) }}
</a>
{% else %}
{{ ibexa_content_name(destination) }}
{% endif %}
{% endset %}
{% set body_row_cols = body_row_cols|merge([{
content: col_raw,
raw: true,
}]) %}

{% set body_row_cols = body_row_cols|merge([
{ content: content_types[destination.contentTypeId].name },
]) %}

{% set col_raw %}
{{ macros.relation_type(relation) }}
{% if (relation.relationFieldDefinitionName) %}
({{ relation.relationFieldDefinitionName }})
{% endif %}
{% endset %}
{% set body_row_cols = body_row_cols|merge([{
content: col_raw,
raw: true,
}]) %}
{% endif %}
{% endset %}
{% set body_row_cols = body_row_cols|merge([{
content: col_raw,
raw: true,
}]) %}

{% set body_row_cols = body_row_cols|merge([
{ content: content_types[destination.contentTypeId].name },
]) %}

{% set col_raw %}
{{ macros.relation_type(relation) }}
{% if (relation.relationFieldDefinitionName) %}
({{ relation.relationFieldDefinitionName }})
{% endif %}
{% endset %}
{% set body_row_cols = body_row_cols|merge([{
content: col_raw,
raw: true,
}]) %}
{% else %}
{% set body_row_cols = body_row_cols|merge([{
attr: { colspan: 8 },
content: 'dashboard.table.relation.unauthorized'|trans({
'%module%': relation.unauthorizedRelation.module,
'%function%': relation.unauthorizedRelation.function,
'%contentId%': relation.unauthorizedRelation.payload.contentId,
})|desc('You do not have the \'%function%\' \'%module%\' permission for content ID: %contentId%'),
}]) %}
{% endif %}

{% set body_rows = body_rows|merge([{ cols: body_row_cols }]) %}
{% endfor %}
Expand Down

0 comments on commit 49f1684

Please sign in to comment.