Roberto Santini 1 місяць тому
джерело
коміт
3d53aa0c87

+ 1
- 0
app/Http/Controllers/AcquistoServizioOperatoreController.php Переглянути файл

@@ -18,6 +18,7 @@ use Illuminate\Routing\Controllers\Middleware;
18 18
 use Illuminate\Support\Facades\Auth;
19 19
 use Illuminate\Support\Facades\Notification;
20 20
 use Illuminate\Validation\ValidationException;
21
+use Illuminate\Support\Facades\Storage;
21 22
 
22 23
 class AcquistoServizioOperatoreController extends Controller implements HasMiddleware
23 24
 {

+ 1
- 0
app/Http/Controllers/HomePageController.php Переглянути файл

@@ -19,6 +19,7 @@ class HomePageController extends Controller
19 19
   public static $permission_group = "Home";
20 20
   public static $permissions = [
21 21
     'view-admin_dashboard' => 'Vedi dashboard amministratore',
22
+    'view-horizon' => 'Accedi a Horizon (code / job)',
22 23
   ];
23 24
 
24 25
   public function welcome()

+ 9
- 9
app/Observers/SegnalazioneObserver.php Переглянути файл

@@ -59,15 +59,15 @@ class SegnalazioneObserver
59 59
     }
60 60
 
61 61
     if ($segnalazione->wasChanged('stato')) {
62
-      $config = ConfigNotifiche::where('event', ConfigNotifiche::CAMBIO_STATO_REPARTO)->first();
63
-      if ($config && $config->is_attivo && $segnalazione->reparto_id) {
64
-        $email = $fresh->email ?? $fresh->reparto?->email;
65
-        if ($email) {
66
-          Notification::route('mail', $email)->notify(
67
-            new SegnalazioneStatoCambiatoReparto($fresh, $segnalazione->getOriginal('stato'))
68
-          );
69
-        }
70
-      }
62
+      // $config = ConfigNotifiche::where('event', ConfigNotifiche::CAMBIO_STATO_REPARTO)->first();
63
+      // if ($config && $config->is_attivo && $segnalazione->reparto_id) {
64
+      //   $email = $fresh->email ?? $fresh->reparto?->email;
65
+      //   if ($email) {
66
+      //     Notification::route('mail', $email)->notify(
67
+      //       new SegnalazioneStatoCambiatoReparto($fresh, $segnalazione->getOriginal('stato'))
68
+      //     );
69
+      //   }
70
+      // }
71 71
     }
72 72
   }
73 73
 

+ 6
- 3
app/Providers/HorizonServiceProvider.php Переглянути файл

@@ -28,9 +28,12 @@ class HorizonServiceProvider extends HorizonApplicationServiceProvider
28 28
     protected function gate(): void
29 29
     {
30 30
         Gate::define('viewHorizon', function ($user = null) {
31
-            return in_array(optional($user)->email, [
32
-                //
33
-            ]);
31
+            if (! $user) {
32
+                return false;
33
+            }
34
+
35
+            return $user->hasRole('superadmin')
36
+                || $user->can('view-horizon');
34 37
         });
35 38
     }
36 39
 }

+ 1
- 1
config/horizon.php Переглянути файл

@@ -70,7 +70,7 @@ return [
70 70
   |
71 71
   */
72 72
 
73
-  'middleware' => ['web'],
73
+  'middleware' => ['web', 'auth'],
74 74
 
75 75
   /*
76 76
   |--------------------------------------------------------------------------

Завантаження…
Відмінити
Зберегти