From c68c4d18b5585fafeaf7de2514c7579461cc6aff Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 27 May 2026 21:24:44 +0200 Subject: [PATCH] A lot of things. --- app/Jobs/CreateXenForoCommentsThread.php | 34 +++++++++++++++++++++ app/Policies/EntryPolicy.php | 39 ++++++++++++++++++++++++ app/Policies/TempFilePolicy.php | 13 ++++++++ 3 files changed, 86 insertions(+) create mode 100644 app/Jobs/CreateXenForoCommentsThread.php create mode 100644 app/Policies/EntryPolicy.php create mode 100644 app/Policies/TempFilePolicy.php diff --git a/app/Jobs/CreateXenForoCommentsThread.php b/app/Jobs/CreateXenForoCommentsThread.php new file mode 100644 index 0000000..0edeb09 --- /dev/null +++ b/app/Jobs/CreateXenForoCommentsThread.php @@ -0,0 +1,34 @@ +createCommentsThread($this->entry); + } +} diff --git a/app/Policies/EntryPolicy.php b/app/Policies/EntryPolicy.php new file mode 100644 index 0000000..1527128 --- /dev/null +++ b/app/Policies/EntryPolicy.php @@ -0,0 +1,39 @@ +_can( 'romhackplaza', 'view' ) ) + return true; + + return false; + } + + public function create(User $user, ?Entry $entry = null ): bool + { + return $user->_can( 'romhackplaza', 'canSubmitEntry' ); + } + + /** + * Determine whether the user can update the model. + */ + public function update(User $user, Entry $entry): bool + { + if( $user->_can('romhackplaza', 'canEditOthersEntries') ) + return true; + + if( $user->_can( 'romhackplaza', 'canEditMyEntries' ) && $entry->user_id === $user->user_id ) + return true; + + return false; + } + +} diff --git a/app/Policies/TempFilePolicy.php b/app/Policies/TempFilePolicy.php new file mode 100644 index 0000000..c1d0433 --- /dev/null +++ b/app/Policies/TempFilePolicy.php @@ -0,0 +1,13 @@ +_can( 'romhackplaza', 'canSubmitTempFile' ); + } +}