Release 2.5.0 (#4454)

- added command to list users
- corrected wrong german translation
- work contract validations
- prevent error with missing params
- use collapsible, minor UI improvement
- added classes to target menu buttons in custom rules
- disable webpack notifier, incompatible with mac arm
- use explicit menu service to generate menu
- bump to fontawesome 6 and replace restart icon
- change repeat icon for recent activities
- moved user bookmarks (favorites) to top nav
- fix totp seconds window (leeway)
- new migration to fix remaining user preferences with dots in name
- remove duplicate named column in user screen
- unify and added translations
- added missing filter and tags to InvoiceSecurity
This commit is contained in:
Kevin Papst
2023-12-01 11:38:17 +01:00
committed by GitHub
parent 16d4a691f8
commit 02bcd45116
72 changed files with 922 additions and 562 deletions

View File

@@ -0,0 +1,46 @@
<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Twig\Runtime;
use App\Entity\User;
use App\Utils\MenuItemModel;
use App\Utils\MenuService;
use Twig\Extension\RuntimeExtensionInterface;
final class MenuExtension implements RuntimeExtensionInterface
{
public function __construct(private MenuService $menuService)
{
}
/**
* @return array<MenuItemModel>
*/
public function getUserShortcuts(User $user): array
{
$shortcuts = $user->getPreferenceValue('favorite_routes');
if (!\is_string($shortcuts) || trim($shortcuts) === '') {
return [];
}
$favMenu = [];
$shortcuts = explode(',', $shortcuts);
$menu = $this->menuService->getKimaiMenu();
foreach ($shortcuts as $fav) {
$tmp = $menu->findById($fav);
if ($tmp !== null && !$tmp->hasChildren()) {
$favMenu[] = clone $tmp;
}
}
return $favMenu;
}
}

View File

@@ -11,6 +11,7 @@ namespace App\Twig;
use App\Twig\Runtime\EncoreExtension;
use App\Twig\Runtime\MarkdownExtension;
use App\Twig\Runtime\MenuExtension;
use App\Twig\Runtime\QrCodeExtension;
use App\Twig\Runtime\ThemeExtension;
use App\Twig\Runtime\TimesheetExtension;
@@ -37,6 +38,7 @@ final class RuntimeExtensions extends AbstractExtension
new TwigFunction('render_widget', [WidgetExtension::class, 'renderWidget'], ['is_safe' => ['html'], 'needs_environment' => true]),
new TwigFunction('icon', [RuntimeExtension::class, 'createIcon'], ['is_safe' => ['html']]),
new TwigFunction('qr_code_data_uri', [QrCodeExtension::class, 'qrCodeDataUriFunction']),
new TwigFunction('user_shortcuts', [MenuExtension::class, 'getUserShortcuts']),
];
}

View File

@@ -29,7 +29,7 @@ final class InvoicePolicy implements SecurityPolicyInterface
$this->policy = new ChainPolicy();
$this->policy->addPolicy(new DefaultPolicy());
$this->policy->addPolicy(new SecurityPolicy(
['block', 'if', 'for', 'set', 'extends'],
['block', 'if', 'for', 'set', 'extends', 'import'],
[
// =================================================================
// vendor/twig/twig/src/Extension/CoreExtension.php
@@ -102,9 +102,16 @@ final class InvoicePolicy implements SecurityPolicyInterface
'currency_symbol',
'language_name',
'locale_name',
'timezone_name',
'format_currency',
'format_number',
'format_*_number',
'format_decimal_number',
'format_currency_number',
'format_percent_number',
'format_scientific_number',
'format_spellout_number',
'format_ordinal_number',
'format_duration_number',
'format_datetime',
'format_date',
'format_time',