46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace MauticPlugin\PlanBundle\Security\Permissions;
|
|
|
|
use Mautic\CoreBundle\Security\Permissions\AbstractPermissions;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
|
|
/**
|
|
* Permission keys: plan:plans:* and plan:tasks:* (view/edit/delete/publish own and other, create, full),
|
|
* and plan:categories:* (managing the "plan" category type).
|
|
*
|
|
* Shown under Settings > Roles. Core discovers this class from Security/Permissions/.
|
|
*/
|
|
class PlanPermissions extends AbstractPermissions
|
|
{
|
|
/**
|
|
* @param mixed[] $params
|
|
*/
|
|
public function __construct(array $params)
|
|
{
|
|
parent::__construct($params);
|
|
|
|
$this->addStandardPermissions('categories');
|
|
$this->addExtendedPermissions('plans');
|
|
$this->addExtendedPermissions('tasks');
|
|
}
|
|
|
|
public function getName(): string
|
|
{
|
|
return 'plan';
|
|
}
|
|
|
|
/**
|
|
* @param array<string, mixed> $options
|
|
* @param array<string, mixed> $data
|
|
*/
|
|
public function buildForm(FormBuilderInterface &$builder, array $options, array $data): void
|
|
{
|
|
$this->addStandardFormFields('plan', 'categories', $builder, $data);
|
|
$this->addExtendedFormFields('plan', 'plans', $builder, $data);
|
|
$this->addExtendedFormFields('plan', 'tasks', $builder, $data);
|
|
}
|
|
}
|