Skip to content

Commit 16d2871

Browse files
committed
remove old translations; remove obsolete admin/user route capabilities
1 parent b989370 commit 16d2871

File tree

17 files changed

+40
-2172
lines changed

17 files changed

+40
-2172
lines changed

src/system/CategoriesBundle/composer.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,7 @@
3838
"class": "Zikula\\CategoriesBundle\\ZikulaCategoriesBundle",
3939
"displayname": "Categories",
4040
"url": "categories",
41-
"icon": "fas fa-sitemap",
42-
"capabilities": {
43-
"admin": {
44-
"route": "zikulacategoriesbundle_category_listcategories"
45-
}
46-
}
41+
"icon": "fas fa-sitemap"
4742
}
4843
}
4944
}

src/system/CoreBundle/Composer/MetaData.php

-8
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ class MetaData implements ArrayAccess
4646

4747
private array $capabilities;
4848

49-
private array $securitySchema;
50-
5149
public function __construct(array $json = [])
5250
{
5351
$this->name = $json['name'];
@@ -61,7 +59,6 @@ public function __construct(array $json = [])
6159
$this->url = $json['extra']['zikula']['url'] ?? '';
6260
$this->icon = $json['extra']['zikula']['icon'] ?? '';
6361
$this->capabilities = $json['extra']['zikula']['capabilities'] ?? [];
64-
$this->securitySchema = $json['extra']['zikula']['securityschema'] ?? [];
6562
}
6663

6764
public function getName(): string
@@ -164,11 +161,6 @@ public function getCapabilities(): array
164161
return $this->capabilities;
165162
}
166163

167-
public function getSecuritySchema(): array
168-
{
169-
return $this->securitySchema;
170-
}
171-
172164
private function confirmTranslator(): void
173165
{
174166
if (!isset($this->translator)) {

src/system/LegalBundle/Controller/ConfigController.php

+7-6
Original file line numberDiff line numberDiff line change
@@ -13,37 +13,38 @@
1313

1414
namespace Zikula\LegalBundle\Controller;
1515

16+
use Nucleos\UserBundle\Model\GroupManager;
1617
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1718
use Symfony\Component\HttpFoundation\Request;
1819
use Symfony\Component\HttpFoundation\Response;
1920
use Symfony\Component\Routing\Annotation\Route;
2021
use Symfony\Component\Security\Http\Attribute\IsGranted;
2122
use Symfony\Contracts\Translation\TranslatorInterface;
22-
use Zikula\GroupsBundle\Repository\GroupRepositoryInterface;
2323
use Zikula\LegalBundle\Form\Type\ConfigType;
2424
use Zikula\LegalBundle\Helper\ResetAgreementHelper;
2525

2626
#[Route('/legal')]
2727
#[IsGranted('ROLE_ADMIN')]
2828
class ConfigController extends AbstractController
2929
{
30-
public function __construct(private readonly TranslatorInterface $translator)
31-
{
30+
public function __construct(
31+
private readonly GroupManager $groupManager,
32+
private readonly TranslatorInterface $translator
33+
) {
3234
}
3335

3436
#[Route('/config', name: 'zikulalegalbundle_config_config')]
3537
public function config(
3638
Request $request,
37-
GroupRepositoryInterface $groupRepository,
3839
ResetAgreementHelper $resetAgreementHelper
3940
): Response {
4041
// build choices for user group selector
4142
$groupChoices = [
4243
$this->translator->trans('All users') => 0,
4344
];
44-
$groups = $groupRepository->findAll();
45+
$groups = $this->groupManager->findGroups();
4546
foreach ($groups as $group) {
46-
$groupChoices[$group->getName()] = $group->getGid();
47+
$groupChoices[$group->getName()] = $group->getId();
4748
}
4849

4950
$form = $this->createForm(ConfigType::class, [], [

src/system/LegalBundle/Helper/ResetAgreementHelper.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
namespace Zikula\LegalBundle\Helper;
1515

16+
use Nucleos\UserBundle\Model\GroupManager;
1617
use Symfony\Bundle\SecurityBundle\Security;
1718
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
18-
use Zikula\GroupsBundle\Repository\GroupRepositoryInterface;
1919
use Zikula\LegalBundle\LegalConstant;
2020
use Zikula\UsersBundle\Repository\UserAttributeRepositoryInterface;
2121

@@ -26,8 +26,8 @@ class ResetAgreementHelper
2626
{
2727
public function __construct(
2828
private readonly Security $security,
29-
private readonly UserAttributeRepositoryInterface $attributeRepository,
30-
private readonly GroupRepositoryInterface $groupRepository
29+
private readonly GroupManager $groupManager,
30+
private readonly UserAttributeRepositoryInterface $attributeRepository
3131
) {
3232
}
3333

@@ -56,8 +56,8 @@ public function reset(int $groupId): bool
5656

5757
$members = [];
5858
if (0 !== $groupId) {
59-
$group = $this->groupRepository->find($groupId);
60-
if (empty($group)) {
59+
$group = $this->groupManager->findGroupBy(['id' => $groupId]);
60+
if (null === $group) {
6161
return false;
6262
}
6363
$members = $group->getUsers()->toArray();
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
<h3>
2-
<span class="fas fa-wrench"></span>
3-
{% trans %}Settings{% endtrans %}
4-
{{ pageSetVar('title', 'Legal settings'|trans) }}
5-
</h3>
1+
{% extends '@EasyAdmin/page/content.html.twig' %}
62

7-
<p class="alert alert-danger"><strong>{% trans %}Important Usage Note{% endtrans %}</strong>: {% trans with {'%dir%': '"/Resources/views/en"', '%dir2%': '"templates/bundles/ZikulaLegalBundle/"'} %}The provided legal statements are samples only. They need to be adapted to your specific needs and locales. You will find the content of the statements in files in the %dir% directory. These templates can be overridden by theme templates, or by global templates you would create in the %dir2% directory (in the appropriate sub-directory for the language you are writing for).{% endtrans %}</p>
3+
{% block content_title 'Legal settings'|trans %}
4+
{% block main %}
5+
<p class="alert alert-danger"><strong>{% trans %}Important Usage Note{% endtrans %}</strong>: {% trans with {'%dir%': '"/Resources/views/en"', '%dir2%': '"templates/bundles/ZikulaLegalBundle/"'} %}The provided legal statements are samples only. They need to be adapted to your specific needs and locales. You will find the content of the statements in files in the %dir% directory. These templates can be overridden by theme templates, or by global templates you would create in the %dir2% directory (in the appropriate sub-directory for the language you are writing for).{% endtrans %}</p>
86

9-
{{ form_start(form) }}
10-
{{ form_errors(form) }}
11-
<fieldset>
12-
<legend>{% trans %}Reset agreement{% endtrans %}</legend>
13-
{{ form_row(form.resetagreement) }}
14-
</fieldset>
15-
<div class="form-group">
16-
<div class="col-md-9 offset-md-3">
17-
{{ form_widget(form.save) }}
18-
{{ form_widget(form.cancel) }}
7+
{{ form_start(form) }}
8+
{{ form_errors(form) }}
9+
<fieldset>
10+
<legend>{% trans %}Reset agreement{% endtrans %}</legend>
11+
{{ form_row(form.resetagreement) }}
12+
</fieldset>
13+
<div class="form-group">
14+
<div class="col-md-9 offset-md-3">
15+
{{ form_widget(form.save) }}
16+
{{ form_widget(form.cancel) }}
17+
</div>
1918
</div>
20-
</div>
21-
{{ form_end(form) }}
19+
{{ form_end(form) }}
20+
{% endblock %}

src/system/LegalBundle/composer.json

+1-9
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,7 @@
2121
"class": "Zikula\\LegalBundle\\ZikulaLegalModule",
2222
"displayname": "Legal",
2323
"url": "legal",
24-
"icon": "fas fa-gavel",
25-
"capabilities": {
26-
"admin": {
27-
"route": "zikulalegalbundle_config_config"
28-
},
29-
"user": {
30-
"route": "zikulalegalbundle_user_legalnotice"
31-
}
32-
}
24+
"icon": "fas fa-gavel"
3325
}
3426
}
3527
}

src/system/ProfileBundle/composer.json

+1-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,7 @@
2323
"class": "Zikula\\ProfileBundle\\ZikulaProfileModule",
2424
"displayname": "Profile",
2525
"url": "profile",
26-
"icon": "fas fa-id-card",
27-
"capabilities": {
28-
"admin": {
29-
"route": "zikulaprofilebundle_property_listproperties"
30-
},
31-
"user": {
32-
"route": "zikulaprofilebundle_profile_display"
33-
}
34-
}
26+
"icon": "fas fa-id-card"
3527
}
3628
}
3729
}

src/system/ThemeBundle/Controller/Dashboard/AbstractThemedDashboardController.php

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
use Symfony\Component\Translation\TranslatableMessage;
2626
use Zikula\CoreBundle\Site\SiteDefinitionInterface;
2727
use Zikula\ThemeBundle\ExtensionMenu\ExtensionMenuCollector;
28-
use Zikula\ThemeBundle\Helper\AdminBundleHelper;
2928
use Zikula\ThemeBundle\Helper\AdminCategoryHelper;
3029
use Zikula\ThemeBundle\Helper\UserMenuExtensionHelper;
3130

@@ -35,7 +34,6 @@ public function __construct(
3534
protected readonly KernelInterface $kernel,
3635
protected readonly AdminUrlGenerator $urlGenerator,
3736
protected readonly AdminCategoryHelper $adminCategoryHelper,
38-
protected readonly AdminBundleHelper $adminBundleHelper,
3937
protected readonly ExtensionMenuCollector $extensionMenuCollector,
4038
protected readonly UserMenuExtensionHelper $userMenuExtensionHelper,
4139
protected readonly SiteDefinitionInterface $site,

src/system/ThemeBundle/Controller/Dashboard/AdminDashboardController.php

+5-14
Original file line numberDiff line numberDiff line change
@@ -40,27 +40,18 @@ public function configureMenuItems(): iterable
4040
yield MenuItem::linkToDashboard(t('Dashboard'), 'fa fa-gauge-high');
4141
yield MenuItem::linktoUrl(t('Website frontend'), 'fas fa-home', '/');
4242

43+
$menuItemsByBundle = $this->extensionMenuCollector->getAllByContext(ExtensionMenuInterface::CONTEXT_ADMIN);
44+
4345
foreach ($this->adminCategoryHelper->getCategories() as $category) {
4446
yield MenuItem::section($category->getName(), $category->getIcon());
4547
$bundleNames = $this->adminCategoryHelper->getBundleAssignments($category);
46-
$adminBundles = $this->adminBundleHelper->getAdminCapableBundles();
47-
foreach ($adminBundles as $bundle) {
48+
foreach ($menuItemsByBundle as $bundleName => $extensionMenuItems) {
49+
$bundle = $this->kernel->getBundle($bundleName);
4850
if (!in_array($bundle->getName(), $bundleNames, true)) {
4951
continue;
5052
}
51-
5253
$bundleInfo = $bundle->getMetaData();
53-
[$menuTextUrl, $menuText] = $this->adminBundleHelper->getAdminRouteInformation($bundleInfo);
54-
55-
$bundleName = (string) $bundle->getName();
56-
$extensionMenuItems = $this->extensionMenuCollector->get($bundleName, ExtensionMenuInterface::CONTEXT_ADMIN);
57-
$isSubMenu = isset($extensionMenuItems);
58-
59-
if ($isSubMenu) {
60-
yield MenuItem::subMenu($menuText, $bundleInfo->getIcon())->setSubItems(iterator_to_array($extensionMenuItems));
61-
} else {
62-
yield MenuItem::linktoRoute($menuText, $bundleInfo->getIcon(), $menuTextUrl);
63-
}
54+
yield MenuItem::subMenu($bundleInfo->getDisplayName(), $bundleInfo->getIcon())->setSubItems(iterator_to_array($extensionMenuItems));
6455
}
6556
}
6657

src/system/ThemeBundle/Controller/Dashboard/UserDashboardController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ public function configureMenuItems(): iterable
4141
$menuItemsByBundle = $this->extensionMenuCollector->getAllByContext(ExtensionMenuInterface::CONTEXT_USER);
4242
foreach ($menuItemsByBundle as $bundleName => $extensionMenuItems) {
4343
$bundle = $this->kernel->getBundle($bundleName);
44-
$bundleInfo = $bundle->getMetaData();
4544

4645
$menuItems = is_array($extensionMenuItems) ? $extensionMenuItems : iterator_to_array($extensionMenuItems);
4746
if (!count($menuItems)) {
4847
continue;
4948
}
49+
$bundleInfo = $bundle->getMetaData();
5050
yield MenuItem::subMenu($bundleInfo->getDisplayName(), $bundleInfo->getIcon())->setSubItems($menuItems);
5151
/*foreach ($menuItems as $item) {
5252
yield $item;

src/system/ThemeBundle/Helper/AdminBundleHelper.php

-66
This file was deleted.

src/system/ThemeBundle/composer.json

+1-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@
5050
"class": "Zikula\\ThemeBundle\\ZikulaThemeBundle",
5151
"displayname": "Theme management",
5252
"url": "theme",
53-
"icon": "fas fa-palette",
54-
"capabilities": {
55-
"admin": {
56-
"route": "zikulathemebundle_branding_overview"
57-
}
58-
}
53+
"icon": "fas fa-palette"
5954
}
6055
}
6156
}

src/system/UsersBundle/composer.json

+1-9
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,7 @@
4242
"class": "Zikula\\UsersBundle\\ZikulaUsersBundle",
4343
"displayname": "Users management",
4444
"url": "users",
45-
"icon": "fas fa-users-cog",
46-
"capabilities": {
47-
"admin": {
48-
"route": "zikulausersbundle_useradministration_listusers"
49-
},
50-
"user": {
51-
"route": "zikulausersbundle_account_menu"
52-
}
53-
}
45+
"icon": "fas fa-users-cog"
5446
}
5547
}
5648
}

translations/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)