X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=app%2FPolicies%2FDiscordChannelPolicy.php;fp=app%2FPolicies%2FDiscordChannelPolicy.php;h=96dadd941375fcf31f205b2c2e873b42651a4132;hb=b45c183b7ba39080b6438c6238bad614c4d3953e;hp=0000000000000000000000000000000000000000;hpb=16662be0b3432d67307ae8c2bb798362d77bab99;p=alttp.git diff --git a/app/Policies/DiscordChannelPolicy.php b/app/Policies/DiscordChannelPolicy.php new file mode 100644 index 0000000..96dadd9 --- /dev/null +++ b/app/Policies/DiscordChannelPolicy.php @@ -0,0 +1,94 @@ +isAdmin(); + } + + /** + * Determine whether the user can view the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordChannel $discordChannel + * @return \Illuminate\Auth\Access\Response|bool + */ + public function view(User $user, DiscordChannel $discordChannel) + { + return !$discordChannel->private || $user->isAdmin() || $discordChannel->guild->owner == $user->id; + } + + /** + * Determine whether the user can create models. + * + * @param \App\Models\User $user + * @return \Illuminate\Auth\Access\Response|bool + */ + public function create(User $user) + { + return false; + } + + /** + * Determine whether the user can update the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordChannel $discordChannel + * @return \Illuminate\Auth\Access\Response|bool + */ + public function update(User $user, DiscordChannel $discordChannel) + { + return false; + } + + /** + * Determine whether the user can delete the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordChannel $discordChannel + * @return \Illuminate\Auth\Access\Response|bool + */ + public function delete(User $user, DiscordChannel $discordChannel) + { + return false; + } + + /** + * Determine whether the user can restore the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordChannel $discordChannel + * @return \Illuminate\Auth\Access\Response|bool + */ + public function restore(User $user, DiscordChannel $discordChannel) + { + return false; + } + + /** + * Determine whether the user can permanently delete the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordChannel $discordChannel + * @return \Illuminate\Auth\Access\Response|bool + */ + public function forceDelete(User $user, DiscordChannel $discordChannel) + { + return false; + } +}