Twig config improvements (#5923)

* deprecate direct kimai_config access, which was only used internally
* prevent access to system configs
* prevent access to most configs in sandbox environments
This commit is contained in:
Kevin Papst
2026-04-25 20:13:33 +02:00
committed by GitHub
parent 3eebb02ad3
commit 3b051e4aa5
11 changed files with 242 additions and 43 deletions

View File

@@ -93,7 +93,7 @@
{% endif %}
{% if stats is not null %}
{% set currency = kimai_config.customerDefaultCurrency %}
{% set currency = config('customerDefaultCurrency') %}
{% if activity.project is not null %}
{% set currency = activity.project.customer.currency %}
{% endif %}

View File

@@ -1,5 +1,5 @@
{% macro avatar_image(user) %}
{% if user.avatar is not empty and kimai_config.themeAllowAvatarUrls %}
{% if user.avatar is not empty and config('themeAllowAvatarUrls') %}
{% set avatar = asset(user.avatar, 'avatars') %}
<span class="avatar" style="background-image:url({{ avatar }})" title="{{ user.displayName }}">&nbsp;</span>
{% else %}

View File

@@ -122,7 +122,7 @@
{% macro user_avatar(user, tooltip, class, badge) %}
{% set avatar = null %}
{% if user.avatar is not empty and kimai_config.themeAllowAvatarUrls %}
{% if user.avatar is not empty and config('themeAllowAvatarUrls') %}
{% set avatar = asset(user.avatar, 'avatars') %}
{% endif %}
{% if not user.enabled %}

View File

@@ -48,12 +48,12 @@
{% block login_social_auth %}
{% if saml_config.isActivated() %}
{% if kimai_config.loginFormActive %}
{% if config('loginFormActive') %}
<div class="hr-text">{{ 'or'|trans({}, 'TablerBundle') }}</div>
{% endif %}
<div class="card-body">
<div class="row">
{% if not kimai_config.loginFormActive %}
{% if not config('loginFormActive') %}
<h2 class="card-title text-center mb-4">{{ block('login_box_msg') }}</h2>
{% endif %}
<div class="col text-center">
@@ -75,25 +75,25 @@
{% endblock %}
{% block login_box %}
{% if kimai_config.loginFormActive %}
{% if config('loginFormActive') %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block login_form %}
{% if kimai_config.loginFormActive %}
{% if config('loginFormActive') %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block password_forgotten %}
{% if kimai_config.passwordResetActive %}
{% if config('passwordResetActive') %}
{{ parent() }}
{% endif %}
{% endblock %}
{% block registration %}
{% if kimai_config.selfRegistrationActive %}
{% if config('selfRegistrationActive') %}
{{ parent() }}
{% endif %}
{% endblock %}

View File

@@ -19,7 +19,7 @@
{% endif %}
</div>
{% block unlock_form %}
{% if kimai_config.loginFormActive %}
{% if config('loginFormActive') %}
<form action="{{ path('tabler_login_check'|tabler_route) }}" method="post" autocomplete="off" class="login-box-body security-login">
<input type="hidden" name="_remember_me" value="on">
<input type="hidden" name="_username" value="{{ app.user.userIdentifier }}">