-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f07d94f
commit f79270e
Showing
5 changed files
with
44 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
namespace Sonata\AdminBundle\Command; | ||
|
||
use Sonata\AdminBundle\Admin\Pool; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
|
@@ -22,8 +23,13 @@ | |
/** | ||
* @author Thomas Rabaix <[email protected]> | ||
*/ | ||
#[AsCommand(name: 'sonata:admin:explain', description: 'Explain an admin service')] | ||
final class ExplainAdminCommand extends Command | ||
{ | ||
// TODO: Remove static properties when support for Symfony < 5.4 is dropped. | ||
protected static $defaultName = 'sonata:admin:explain'; | ||
protected static $defaultDescription = 'Explain an admin service'; | ||
|
||
private Pool $pool; | ||
|
||
/** | ||
|
@@ -38,9 +44,11 @@ public function __construct(Pool $pool) | |
|
||
public function configure(): void | ||
{ | ||
\assert(null !== static::$defaultDescription); | ||
|
||
$this | ||
->setName('sonata:admin:explain') | ||
->setDescription('Explain an admin service') | ||
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped. | ||
->setDescription(static::$defaultDescription) | ||
->addArgument('admin', InputArgument::REQUIRED, 'The admin service id'); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
|
||
use Sonata\AdminBundle\Admin\Pool; | ||
use Sonata\AdminBundle\Util\ObjectAclManipulatorInterface; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
@@ -24,8 +25,13 @@ | |
/** | ||
* @author Thomas Rabaix <[email protected]> | ||
*/ | ||
#[AsCommand(name: 'sonata:admin:generate-object-acl', description: 'Install ACL for the objects of the Admin Classes.')] | ||
final class GenerateObjectAclCommand extends QuestionableCommand | ||
{ | ||
// TODO: Remove static properties when support for Symfony < 5.4 is dropped. | ||
protected static $defaultName = 'sonata:admin:generate-object-acl'; | ||
protected static $defaultDescription = 'Install ACL for the objects of the Admin Classes.'; | ||
|
||
private string $userModelClass = ''; | ||
|
||
private Pool $pool; | ||
|
@@ -52,9 +58,11 @@ public function __construct(Pool $pool, array $aclObjectManipulators) | |
|
||
public function configure(): void | ||
{ | ||
\assert(null !== static::$defaultDescription); | ||
|
||
$this | ||
->setName('sonata:admin:generate-object-acl') | ||
->setDescription('Install ACL for the objects of the Admin Classes.') | ||
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped. | ||
->setDescription(static::$defaultDescription) | ||
->addOption('object_owner', null, InputOption::VALUE_OPTIONAL, 'If set, the task will set the object owner for each admin.') | ||
->addOption('user_model', null, InputOption::VALUE_OPTIONAL, 'Fully qualified class name <comment>App\Model\User</comment>. If not set, it will be asked the first time an object owner is set.') | ||
->addOption('step', null, InputOption::VALUE_NONE, 'If set, the task will ask for each admin if the ACLs need to be generated and what object owner to set, if any.'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,21 @@ | |
namespace Sonata\AdminBundle\Command; | ||
|
||
use Sonata\AdminBundle\Admin\Pool; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* @author Thomas Rabaix <[email protected]> | ||
*/ | ||
#[AsCommand(name: 'sonata:admin:list', description: 'List all admin services available')] | ||
final class ListAdminCommand extends Command | ||
{ | ||
// TODO: Remove static properties when support for Symfony < 5.4 is dropped. | ||
protected static $defaultName = 'sonata:admin:list'; | ||
protected static $defaultDescription = 'List all admin services available'; | ||
|
||
private Pool $pool; | ||
|
||
/** | ||
|
@@ -37,9 +43,11 @@ public function __construct(Pool $pool) | |
|
||
public function configure(): void | ||
{ | ||
\assert(null !== static::$defaultDescription); | ||
|
||
$this | ||
->setName('sonata:admin:list') | ||
->setDescription('List all admin services available'); | ||
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped. | ||
->setDescription(static::$defaultDescription); | ||
} | ||
|
||
public function execute(InputInterface $input, OutputInterface $output): int | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,15 +15,21 @@ | |
|
||
use Sonata\AdminBundle\Admin\Pool; | ||
use Sonata\AdminBundle\Util\AdminAclManipulatorInterface; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
/** | ||
* @author Thomas Rabaix <[email protected]> | ||
*/ | ||
#[AsCommand(name: 'sonata:admin:setup-acl', description: 'Install ACL for Admin Classes')] | ||
final class SetupAclCommand extends Command | ||
{ | ||
// TODO: Remove static properties when support for Symfony < 5.4 is dropped. | ||
protected static $defaultName = 'sonata:admin:setup-acl'; | ||
protected static $defaultDescription = 'Install ACL for Admin Classes'; | ||
|
||
private Pool $pool; | ||
|
||
private AdminAclManipulatorInterface $aclManipulator; | ||
|
@@ -41,9 +47,11 @@ public function __construct(Pool $pool, AdminAclManipulatorInterface $aclManipul | |
|
||
public function configure(): void | ||
{ | ||
\assert(null !== static::$defaultDescription); | ||
|
||
$this | ||
->setName('sonata:admin:setup-acl') | ||
->setDescription('Install ACL for Admin Classes'); | ||
// TODO: Remove setDescription when support for Symfony < 5.4 is dropped. | ||
->setDescription(static::$defaultDescription); | ||
} | ||
|
||
public function execute(InputInterface $input, OutputInterface $output): int | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters