Relocate the item type lists (insights, allocations, objectives, tasks, stakeholders, audience values) from the Configuration tab to a dedicated "Item types" page under Programs, served by ItemTypesController at /program-item-types and guarded by the new program:itemtypes:view permission. The Program settings tab in Configuration now only holds the general settings (currency, stakeholder phone region, audience attribute toggles), so ConfigSubscriber no longer needs the item repositories; the in-use type protection moved to ItemTypeInUseGuard.
54 lines
1.8 KiB
PHP
54 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\ProgramBundle\Security\Permissions;
|
|
|
|
use Mautic\CoreBundle\Security\Permissions\AbstractPermissions;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
/**
|
|
* Permission keys: program:initiatives:*, program:tasks:*, program:stakeholders:* and
|
|
* program:audiences:* (view/edit/delete/publish own and other, create, full), program:itemtypes:*
|
|
* (the Item types page, Programs > Item types), and program:categories:* (managing the
|
|
* "initiative" category type).
|
|
*
|
|
* Shown under Settings > Roles. Core discovers this class from Security/Permissions/.
|
|
*/
|
|
class ProgramPermissions extends AbstractPermissions
|
|
{
|
|
/**
|
|
* @param mixed[] $params
|
|
*/
|
|
public function __construct(array $params)
|
|
{
|
|
parent::__construct($params);
|
|
|
|
$this->addStandardPermissions('categories');
|
|
$this->addExtendedPermissions('initiatives');
|
|
$this->addExtendedPermissions('tasks');
|
|
$this->addExtendedPermissions('stakeholders');
|
|
$this->addExtendedPermissions('audiences');
|
|
$this->addStandardPermissions('itemtypes');
|
|
}
|
|
|
|
public function getName(): string
|
|
{
|
|
return 'program';
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed> $options
|
|
* @param array<string, mixed> $data
|
|
*/
|
|
public function buildForm(FormBuilderInterface &$builder, array $options, array $data): void
|
|
{
|
|
$this->addStandardFormFields('program', 'categories', $builder, $data);
|
|
$this->addExtendedFormFields('program', 'initiatives', $builder, $data);
|
|
$this->addExtendedFormFields('program', 'tasks', $builder, $data);
|
|
$this->addExtendedFormFields('program', 'stakeholders', $builder, $data);
|
|
$this->addExtendedFormFields('program', 'audiences', $builder, $data);
|
|
$this->addStandardFormFields('program', 'itemtypes', $builder, $data);
|
|
}
|
|
}
|