X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FPolicies%2FUserPolicy.php;h=31f9481743a5dec9d75db78d5474b6b8267b8978;hb=HEAD;hp=67bc561b8c2b2d922f6b40944e43863d2a88b6ce;hpb=920f11ddfeb2175e4e1556886773dcd044c6085b;p=alttp.git diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index 67bc561..31f9481 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -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. *