Skip to content

Commit

Permalink
Add permission
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreesen committed Oct 1, 2024
1 parent 398a471 commit 1b96087
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 46 deletions.
4 changes: 4 additions & 0 deletions config/pimcore/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
doctrine_migrations:
migrations_paths:
Neusta\Pimcore\AreabrickConfigBundle\Migrations: '@NeustaPimcoreAreabrickConfigBundle/migrations'

neusta_converter:
converter:
neusta_pimcore_areabrick_config.brick.converter:
Expand Down
27 changes: 27 additions & 0 deletions migrations/Version20241001090000.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);

namespace Neusta\Pimcore\AreabrickConfigBundle\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Pimcore\Migrations\BundleAwareMigration;

final class Version20241001090000 extends BundleAwareMigration
{
private const PERMISSION_KEY_AREABRICKS = "'neusta_areabrick_config.areabrick_overview'";

public function up(Schema $schema): void
{
$this->addSql("INSERT IGNORE INTO users_permission_definitions (`key`, `category`) VALUES(" . self::PERMISSION_KEY_AREABRICKS . ", 'Neusta Areabrick Config Bundle');");
}

public function down(Schema $schema): void
{
$this->addSql("DELETE FROM users_permission_definitions WHERE `key` = " . self::PERMISSION_KEY_AREABRICKS . ";");
}

protected function getBundleName(): string
{
return 'NeustaPimcoreAreabrickConfigBundle';
}
}
2 changes: 1 addition & 1 deletion public/js/areabrick-overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ neusta.areabrick_config.areabrick_overview = Class.create({
if (!this.panel) {
this.panel = Ext.create('Ext.panel.Panel', {
id: this.tabId,
title: t('neusta_pimcore_areabrick_config.areabricks.overview.title'),
title: t('neusta_areabrick_config.areabrick_overview'),
iconCls: 'pimcore_icon_areabrick',
border: false,
layout: 'fit',
Expand Down
4 changes: 2 additions & 2 deletions public/js/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ neusta.areabrick_config.startup = Class.create({
return;
}

if (!pimcore.globalmanager.get('user').isAllowed('areabricks')) {
if (!pimcore.globalmanager.get('user').isAllowed('neusta_areabrick_config.areabrick_overview')) {
return;
}

const items = {
text: t('neusta_pimcore_areabrick_config.areabricks.overview.title'),
text: t('neusta_areabrick_config.areabrick_overview'),
iconCls: 'pimcore_nav_icon_objectbricks',
priority: 31,
itemId: 'pimcore_menu_tools_areabricks',
Expand Down
35 changes: 0 additions & 35 deletions src/Migrations/Version20241001090000.php

This file was deleted.

6 changes: 2 additions & 4 deletions translations/admin.de.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
neusta_pimcore_areabrick_config:
areabricks:
overview:
title: Areabrick-Übersicht
neusta_areabrick_config:
areabrick_overview: Areabrick-Übersicht
6 changes: 2 additions & 4 deletions translations/admin.en.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
neusta_pimcore_areabrick_config:
areabricks:
overview:
title: Areabrick Overview
neusta_areabrick_config:
areabrick_overview: Areabrick Overview

0 comments on commit 1b96087

Please sign in to comment.