2016-04-23 13:14:26 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace BookStack\Console\Commands;
|
|
|
|
|
2016-05-01 16:20:50 -04:00
|
|
|
use BookStack\Services\PermissionService;
|
2016-04-23 13:14:26 -04:00
|
|
|
use Illuminate\Console\Command;
|
|
|
|
|
|
|
|
class RegeneratePermissions extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2017-02-26 04:14:18 -05:00
|
|
|
protected $signature = 'bookstack:regenerate-permissions';
|
2016-04-23 13:14:26 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'Regenerate all system permissions';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The service to handle the permission system.
|
|
|
|
*
|
2016-05-01 16:20:50 -04:00
|
|
|
* @var PermissionService
|
2016-04-23 13:14:26 -04:00
|
|
|
*/
|
2016-05-01 16:20:50 -04:00
|
|
|
protected $permissionService;
|
2016-04-23 13:14:26 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new command instance.
|
|
|
|
*
|
2016-05-01 16:20:50 -04:00
|
|
|
* @param PermissionService $permissionService
|
2016-04-23 13:14:26 -04:00
|
|
|
*/
|
2016-05-01 16:20:50 -04:00
|
|
|
public function __construct(PermissionService $permissionService)
|
2016-04-23 13:14:26 -04:00
|
|
|
{
|
2016-05-01 16:20:50 -04:00
|
|
|
$this->permissionService = $permissionService;
|
2016-04-23 13:14:26 -04:00
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
2016-05-01 16:20:50 -04:00
|
|
|
$this->permissionService->buildJointPermissions();
|
2017-02-26 04:14:18 -05:00
|
|
|
$this->comment('Permissions regenerated');
|
2016-04-23 13:14:26 -04:00
|
|
|
}
|
|
|
|
}
|