FEATURE #2048: add basics of permissions management
This commit is contained in:
@@ -2,30 +2,36 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use App\Models\Content\Content;
|
||||
use App\Models\Module;
|
||||
use App\Models\User;
|
||||
use App\Policies\ContentPolicy;
|
||||
use App\Policies\ModulePolicy;
|
||||
use App\Policies\UserPolicy;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as IlluminateAuthServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
class AuthServiceProvider extends IlluminateAuthServiceProvider
|
||||
{
|
||||
/**
|
||||
* The policy mappings for the application.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $policies = [
|
||||
'App\Model' => 'App\Policies\ModelPolicy',
|
||||
Content::class => ContentPolicy::class,
|
||||
User::class => UserPolicy::class,
|
||||
Module::class => ModulePolicy::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any application authentication / authorization services.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
|
||||
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot(GateContract $gate)
|
||||
public function boot()
|
||||
{
|
||||
$this->registerPolicies($gate);
|
||||
|
||||
$this->registerPolicies();
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,21 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapAdminRoutes();
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "admin" routes for the application.
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
* @return void
|
||||
*/
|
||||
protected function mapAdminRoutes()
|
||||
{
|
||||
Route::namespace($this->namespace.'\\Admin')
|
||||
->group(base_path('routes/admin.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
@@ -31,7 +43,6 @@ class RouteServiceProvider extends ServiceProvider
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::namespace($this->namespace)
|
||||
->middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user