Adding new asgard:user:grant-permissions command to grant all module permissions to admin role

parent cfa3997d
<?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 [
];
}
}
......@@ -8,6 +8,7 @@ use Illuminate\Support\ServiceProvider;
use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration;
use Modules\User\Console\GrantRolePermissionsCommand;
use Modules\User\Contracts\Authentication;
use Modules\User\Entities\UserToken;
use Modules\User\Events\Handlers\RegisterUserSidebar;
......@@ -66,6 +67,9 @@ class UserServiceProvider extends ServiceProvider
BuildingSidebar::class,
$this->getSidebarClassForModule('user', RegisterUserSidebar::class)
);
$this->commands([
GrantRolePermissionsCommand::class,
]);
}
/**
......
url: https://github.com/AsgardCms/Platform
versions:
"3.2.0@unreleased":
added:
- Adding new <code>asgard:user:grant-permissions</code> command to grant all module permissions to admin role
"3.1.0":
added:
- Seeding new media.folders permissions on install
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment