Adding new asgard:user:remove-permissions command to remove all permissions of...

Adding new asgard:user:remove-permissions command to remove all permissions of given module from roles and users
parent 1321a74c
<?php
namespace Modules\User\Console;
use Illuminate\Console\Command;
use Modules\User\Permissions\PermissionsRemover;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class RemoveModulePermissionsCommand extends Command
{
protected $name = 'asgard:user:remove-permissions';
protected $description = 'Remove all the permissions for given module from any role or user';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$module = $this->argument('module');
(new PermissionsRemover($module))->removeAll();
$this->info("All permissions for [$module] have been removed");
}
/**
* 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 [
];
}
}
......@@ -9,6 +9,7 @@ use Modules\Core\Events\BuildingSidebar;
use Modules\Core\Traits\CanGetSidebarClassForModule;
use Modules\Core\Traits\CanPublishConfiguration;
use Modules\User\Console\GrantModulePermissionsCommand;
use Modules\User\Console\RemoveModulePermissionsCommand;
use Modules\User\Contracts\Authentication;
use Modules\User\Entities\UserToken;
use Modules\User\Events\Handlers\RegisterUserSidebar;
......@@ -69,6 +70,7 @@ class UserServiceProvider extends ServiceProvider
);
$this->commands([
GrantModulePermissionsCommand::class,
RemoveModulePermissionsCommand::class,
]);
}
......
......@@ -3,6 +3,7 @@ versions:
"3.2.0@unreleased":
added:
- Adding new <code>asgard:user:grant-permissions</code> command to grant all module permissions to admin role
- Adding new <code>asgard:user:remove-permissions</code> command to remove all permissions of given module from roles and users
"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