Skip to content

Commit 3fc62cf

Browse files
committed
Added white/blacklist support for create cron command
1 parent 17d36cd commit 3fc62cf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Commands/CronCreateCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Cron\Exception\InvalidPatternException;
66
use Cron\Validator\CrontabValidator;
77
use Illuminate\Console\Command;
8+
use Tolacika\CronBundle\CronBundle;
89
use Tolacika\CronBundle\Models\CronJob;
910

1011
class CronCreateCommand extends Command
@@ -66,6 +67,10 @@ public function handle()
6667
// Invalid if can't find through application
6768
$this->getApplication()->get($command);
6869

70+
if (!CronBundle::isCommandAllowed($command)) {
71+
throw new \InvalidArgumentException("Command not allowed");
72+
}
73+
6974
return $command;
7075
});
7176

0 commit comments

Comments
 (0)