Merge remote-tracking branch 'origin/support/2.7' into support/3.0

This commit is contained in:
Molkobain
2024-03-11 21:18:53 +01:00
2 changed files with 20 additions and 10 deletions

View File

@@ -29,6 +29,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\HttpException;
use UserRights; use UserRights;
use utils;
/** /**
* Class UserProvider * Class UserProvider
@@ -91,6 +92,9 @@ class UserProvider implements ContainerAwareInterface
} }
$this->oContainer->set('combodo.current_user', $oUser); $this->oContainer->set('combodo.current_user', $oUser);
// User allowed to log off or not
$this->oContainer->set('combodo.current_user.can_logoff', utils::CanLogOff());
// Allowed portals // Allowed portals
$aAllowedPortals = UserRights::GetAllowedPortals(); $aAllowedPortals = UserRights::GetAllowedPortals();

View File

@@ -3,11 +3,13 @@
{% if app['combodo.current_user'] is defined and app['combodo.current_user'] is not null %} {% if app['combodo.current_user'] is defined and app['combodo.current_user'] is not null %}
{% set bUserConnected = true %} {% set bUserConnected = true %}
{% set bUserCanLogOff = app['combodo.current_user.can_logoff'] %}
{% set sUserFullname = app['combodo.current_user'].Get('first_name') ~ ' ' ~ app['combodo.current_user'].Get('last_name') %} {% set sUserFullname = app['combodo.current_user'].Get('first_name') ~ ' ' ~ app['combodo.current_user'].Get('last_name') %}
{% set sUserEmail = app['combodo.current_user'].Get('email') %} {% set sUserEmail = app['combodo.current_user'].Get('email') %}
{% set sUserPhotoUrl = app['combodo.current_contact.photo_url'] %} {% set sUserPhotoUrl = app['combodo.current_contact.photo_url'] %}
{% else %} {% else %}
{% set bUserConnected = false %} {% set bUserConnected = false %}
{% set bUserCanLogOff = false %}
{% set sUserFullname = '' %} {% set sUserFullname = '' %}
{% set sUserEmail = '' %} {% set sUserEmail = '' %}
{% set sUserPhotoUrl = app['combodo.portal.base.absolute_url'] ~ 'img/user-profile-default-256px.png' %} {% set sUserPhotoUrl = app['combodo.portal.base.absolute_url'] ~ 'img/user-profile-default-256px.png' %}
@@ -230,11 +232,13 @@
<li><a href="{{ aPortal.url }}" target="_blank"><span class="brick_icon {{ sIconClass }} fa-2x fa-fw"></span>{{ aPortal.label|dict_s }}</a></li> <li><a href="{{ aPortal.url }}" target="_blank"><span class="brick_icon {{ sIconClass }} fa-2x fa-fw"></span>{{ aPortal.label|dict_s }}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{# We display the separator only if the user has more then 1 portal. Meaning default portal + console or several portal at least #} {% if bUserCanLogOff %}
{% if app['combodo.current_user.allowed_portals']|length > 1 %} {# We display the separator only if the user has more then 1 portal. Meaning default portal + console or several portal at least #}
<li role="separator" class="divider"></li> {% if app['combodo.current_user.allowed_portals']|length > 1 %}
{% endif %} <li role="separator" class="divider"></li>
<li><a href="{{ app['combodo.absolute_url'] }}pages/logoff.php"><span class="brick_icon fas fa-sign-out-alt fa-2x fa-fw"></span>{{ 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout'|dict_s }}</a></li> {% endif %}
<li><a href="{{ app['combodo.absolute_url'] }}pages/logoff.php"><span class="brick_icon fas fa-sign-out-alt fa-2x fa-fw"></span>{{ 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout'|dict_s }}</a></li>
{% endif %}
{% endif %} {% endif %}
</ul> </ul>
</div> </div>
@@ -269,11 +273,13 @@
<li><a href="{{ aPortal.url }}" {% if app['combodo.portal.instance.conf'].properties.allowed_portals.opening_mode == 'tab' %}target="_blank"{% endif %} title="{{ aPortal.label|dict_s }}"><span class="brick_icon {{ sGlyphiconClass }} fa-lg fa-fw"></span>{{ aPortal.label|dict_s }}</a></li> <li><a href="{{ aPortal.url }}" {% if app['combodo.portal.instance.conf'].properties.allowed_portals.opening_mode == 'tab' %}target="_blank"{% endif %} title="{{ aPortal.label|dict_s }}"><span class="brick_icon {{ sGlyphiconClass }} fa-lg fa-fw"></span>{{ aPortal.label|dict_s }}</a></li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{# We display the separator only if the user has more then 1 portal. Meaning default portal + console or several portal at least #} {% if bUserCanLogOff %}
{% if app['combodo.current_user.allowed_portals']|length > 1 %} {# We display the separator only if the user has more then 1 portal. Meaning default portal + console or several portal at least #}
<li role="separator" class="divider"></li> {% if app['combodo.current_user.allowed_portals']|length > 1 %}
{% endif %} <li role="separator" class="divider"></li>
<li><a href="{{ app['combodo.absolute_url'] }}pages/logoff.php"><span class="brick_icon fas fa-sign-out-alt fa-lg fa-fw"></span>{{ 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout'|dict_s }}</a></li> {% endif %}
<li><a href="{{ app['combodo.absolute_url'] }}pages/logoff.php"><span class="brick_icon fas fa-sign-out-alt fa-lg fa-fw"></span>{{ 'Brick:Portal:UserProfile:Navigation:Dropdown:Logout'|dict_s }}</a></li>
{% endif %}
</ul> </ul>
</div> </div>
</div> </div>