-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new asgard:user:grant-permissions command to grant all module…
… permissions to admin role
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Modules\User\Console; | ||
|
||
use Illuminate\Console\Command; | ||
use Modules\User\Permissions\PermissionsAdder; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
|
||
class GrantRolePermissionsCommand extends Command | ||
{ | ||
protected $name = 'asgard:user:grant-permissions'; | ||
protected $description = 'Grant all the permissions to the admin role of given module'; | ||
|
||
public function handle() | ||
{ | ||
$module = $this->argument('module'); | ||
|
||
(new PermissionsAdder($module))->addAll(); | ||
|
||
$this->info("All permissions for [$module] have been added to the admin role"); | ||
} | ||
|
||
/** | ||
* Get the console command arguments. | ||
* | ||
* @return array | ||
*/ | ||
protected function getArguments() | ||
{ | ||
return [ | ||
['module', InputArgument::REQUIRED, 'Module name'], | ||
]; | ||
} | ||
|
||
/** | ||
* Get the console command options. | ||
* | ||
* @return array | ||
*/ | ||
protected function getOptions() | ||
{ | ||
return [ | ||
]; | ||
} | ||
} |
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
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