]> git.localhorst.tv Git - alttp.git/blobdiff - app/Policies/UserPolicy.php
respond to whispers
[alttp.git] / app / Policies / UserPolicy.php
index 67bc561b8c2b2d922f6b40944e43863d2a88b6ce..31f9481743a5dec9d75db78d5474b6b8267b8978 100644 (file)
@@ -15,7 +15,7 @@ class UserPolicy
         * @param  \App\Models\User  $user
         * @return \Illuminate\Auth\Access\Response|bool
         */
-       public function viewAny(User $user)
+       public function viewAny(?User $user)
        {
                return true;
        }
@@ -27,7 +27,7 @@ class UserPolicy
         * @param  \App\Models\User  $model
         * @return \Illuminate\Auth\Access\Response|bool
         */
-       public function view(User $user, User $model)
+       public function view(?User $user, User $model)
        {
                return true;
        }
@@ -91,6 +91,18 @@ class UserPolicy
                return false;
        }
 
+       /**
+        * Determine whether the user change the stream link of the model.
+        *
+        * @param  \App\Models\User  $user
+        * @param  \App\Models\User  $model
+        * @return \Illuminate\Auth\Access\Response|bool
+        */
+       public function setNickname(User $user, User $model)
+       {
+               return $user->role == 'admin' || $user->id == $model->id;
+       }
+
        /**
         * Determine whether the user change the stream link of the model.
         *