diff --git a/Modules/User/Console/RemoveModulePermissionsCommand.php b/Modules/User/Console/RemoveModulePermissionsCommand.php new file mode 100644 index 000000000..057e4b991 --- /dev/null +++ b/Modules/User/Console/RemoveModulePermissionsCommand.php @@ -0,0 +1,51 @@ +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 [ + ]; + } +} diff --git a/Modules/User/Providers/UserServiceProvider.php b/Modules/User/Providers/UserServiceProvider.php index 4f27b7094..61173269e 100644 --- a/Modules/User/Providers/UserServiceProvider.php +++ b/Modules/User/Providers/UserServiceProvider.php @@ -9,6 +9,7 @@ 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 @@ public function register() ); $this->commands([ GrantModulePermissionsCommand::class, + RemoveModulePermissionsCommand::class, ]); } diff --git a/Modules/User/changelog.yml b/Modules/User/changelog.yml index 34321236b..d85fa3e58 100644 --- a/Modules/User/changelog.yml +++ b/Modules/User/changelog.yml @@ -3,6 +3,7 @@ versions: "3.2.0@unreleased": added: - Adding new asgard:user:grant-permissions command to grant all module permissions to admin role + - Adding new asgard:user:remove-permissions command to remove all permissions of given module from roles and users "3.1.0": added: - Seeding new media.folders permissions on install