namespace App\Providers;
use Cubist\Socialite\CubistSocialiteAuthServiceProvider;
-use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
-use Mpyw\NullAuth\NullAuthServiceProvider;
-class AuthServiceProvider extends CubistSocialiteAuthServiceProvider
+class AuthServiceProvider extends \Cubist\Backpack\Providers\AuthServiceProvider
{
/**
* The policy mappings for the application.
public function boot()
{
parent::boot();
-
- $superadmins = ['vincent.vanwaelscappel@odile.space'];
- $admins = ['jean-francois.legras@odile.space', 'christelle.perthus@odile.space'];
- $viewers = [];
-
- Gate::before(function ($user, $ability) use ($superadmins, $admins, $viewers) {
- if (in_array($user->email, $superadmins)) {
- return true;
- }
- if (in_array($user->email, $admins)) {
- return $ability === 'admin' || $ability === 'view';
- }
- if (in_array($user->email, $viewers)) {
- return $ability === 'view';
- }
- return null;
- });
}
}