From aa77c1c9404a6ae8eeece9e867cc6d89dcdc8ea6 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Tue, 16 Dec 2025 13:01:14 +0700 Subject: [PATCH] feat: Add ContentRecap, Cooperation, IssueManagement, Journalist, MediaMonitoring, News, and Announcement policies. --- app/Policies/AnnouncementPolicy.php | 69 ++++++++++++++++++++++++++ app/Policies/ContentRecapPolicy.php | 69 ++++++++++++++++++++++++++ app/Policies/CooperationPolicy.php | 69 ++++++++++++++++++++++++++ app/Policies/IssueManagementPolicy.php | 69 ++++++++++++++++++++++++++ app/Policies/JournalistPolicy.php | 69 ++++++++++++++++++++++++++ app/Policies/MediaMonitoringPolicy.php | 69 ++++++++++++++++++++++++++ app/Policies/NewsPolicy.php | 69 ++++++++++++++++++++++++++ 7 files changed, 483 insertions(+) create mode 100644 app/Policies/AnnouncementPolicy.php create mode 100644 app/Policies/ContentRecapPolicy.php create mode 100644 app/Policies/CooperationPolicy.php create mode 100644 app/Policies/IssueManagementPolicy.php create mode 100644 app/Policies/JournalistPolicy.php create mode 100644 app/Policies/MediaMonitoringPolicy.php create mode 100644 app/Policies/NewsPolicy.php diff --git a/app/Policies/AnnouncementPolicy.php b/app/Policies/AnnouncementPolicy.php new file mode 100644 index 0000000..f7897e1 --- /dev/null +++ b/app/Policies/AnnouncementPolicy.php @@ -0,0 +1,69 @@ +can('ViewAny:Announcement'); + } + + public function view(AuthUser $authUser, Announcement $announcement): bool + { + return $authUser->can('View:Announcement'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:Announcement'); + } + + public function update(AuthUser $authUser, Announcement $announcement): bool + { + return $authUser->can('Update:Announcement'); + } + + public function delete(AuthUser $authUser, Announcement $announcement): bool + { + return $authUser->can('Delete:Announcement'); + } + + public function restore(AuthUser $authUser, Announcement $announcement): bool + { + return $authUser->can('Restore:Announcement'); + } + + public function forceDelete(AuthUser $authUser, Announcement $announcement): bool + { + return $authUser->can('ForceDelete:Announcement'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:Announcement'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:Announcement'); + } + + public function replicate(AuthUser $authUser, Announcement $announcement): bool + { + return $authUser->can('Replicate:Announcement'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:Announcement'); + } +} diff --git a/app/Policies/ContentRecapPolicy.php b/app/Policies/ContentRecapPolicy.php new file mode 100644 index 0000000..138a67a --- /dev/null +++ b/app/Policies/ContentRecapPolicy.php @@ -0,0 +1,69 @@ +can('ViewAny:ContentRecap'); + } + + public function view(AuthUser $authUser, ContentRecap $contentRecap): bool + { + return $authUser->can('View:ContentRecap'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:ContentRecap'); + } + + public function update(AuthUser $authUser, ContentRecap $contentRecap): bool + { + return $authUser->can('Update:ContentRecap'); + } + + public function delete(AuthUser $authUser, ContentRecap $contentRecap): bool + { + return $authUser->can('Delete:ContentRecap'); + } + + public function restore(AuthUser $authUser, ContentRecap $contentRecap): bool + { + return $authUser->can('Restore:ContentRecap'); + } + + public function forceDelete(AuthUser $authUser, ContentRecap $contentRecap): bool + { + return $authUser->can('ForceDelete:ContentRecap'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:ContentRecap'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:ContentRecap'); + } + + public function replicate(AuthUser $authUser, ContentRecap $contentRecap): bool + { + return $authUser->can('Replicate:ContentRecap'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:ContentRecap'); + } +} diff --git a/app/Policies/CooperationPolicy.php b/app/Policies/CooperationPolicy.php new file mode 100644 index 0000000..642183e --- /dev/null +++ b/app/Policies/CooperationPolicy.php @@ -0,0 +1,69 @@ +can('ViewAny:Cooperation'); + } + + public function view(AuthUser $authUser, Cooperation $cooperation): bool + { + return $authUser->can('View:Cooperation'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:Cooperation'); + } + + public function update(AuthUser $authUser, Cooperation $cooperation): bool + { + return $authUser->can('Update:Cooperation'); + } + + public function delete(AuthUser $authUser, Cooperation $cooperation): bool + { + return $authUser->can('Delete:Cooperation'); + } + + public function restore(AuthUser $authUser, Cooperation $cooperation): bool + { + return $authUser->can('Restore:Cooperation'); + } + + public function forceDelete(AuthUser $authUser, Cooperation $cooperation): bool + { + return $authUser->can('ForceDelete:Cooperation'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:Cooperation'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:Cooperation'); + } + + public function replicate(AuthUser $authUser, Cooperation $cooperation): bool + { + return $authUser->can('Replicate:Cooperation'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:Cooperation'); + } +} diff --git a/app/Policies/IssueManagementPolicy.php b/app/Policies/IssueManagementPolicy.php new file mode 100644 index 0000000..895b4fc --- /dev/null +++ b/app/Policies/IssueManagementPolicy.php @@ -0,0 +1,69 @@ +can('ViewAny:IssueManagement'); + } + + public function view(AuthUser $authUser, IssueManagement $issueManagement): bool + { + return $authUser->can('View:IssueManagement'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:IssueManagement'); + } + + public function update(AuthUser $authUser, IssueManagement $issueManagement): bool + { + return $authUser->can('Update:IssueManagement'); + } + + public function delete(AuthUser $authUser, IssueManagement $issueManagement): bool + { + return $authUser->can('Delete:IssueManagement'); + } + + public function restore(AuthUser $authUser, IssueManagement $issueManagement): bool + { + return $authUser->can('Restore:IssueManagement'); + } + + public function forceDelete(AuthUser $authUser, IssueManagement $issueManagement): bool + { + return $authUser->can('ForceDelete:IssueManagement'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:IssueManagement'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:IssueManagement'); + } + + public function replicate(AuthUser $authUser, IssueManagement $issueManagement): bool + { + return $authUser->can('Replicate:IssueManagement'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:IssueManagement'); + } +} diff --git a/app/Policies/JournalistPolicy.php b/app/Policies/JournalistPolicy.php new file mode 100644 index 0000000..264e49d --- /dev/null +++ b/app/Policies/JournalistPolicy.php @@ -0,0 +1,69 @@ +can('ViewAny:Journalist'); + } + + public function view(AuthUser $authUser, Journalist $journalist): bool + { + return $authUser->can('View:Journalist'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:Journalist'); + } + + public function update(AuthUser $authUser, Journalist $journalist): bool + { + return $authUser->can('Update:Journalist'); + } + + public function delete(AuthUser $authUser, Journalist $journalist): bool + { + return $authUser->can('Delete:Journalist'); + } + + public function restore(AuthUser $authUser, Journalist $journalist): bool + { + return $authUser->can('Restore:Journalist'); + } + + public function forceDelete(AuthUser $authUser, Journalist $journalist): bool + { + return $authUser->can('ForceDelete:Journalist'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:Journalist'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:Journalist'); + } + + public function replicate(AuthUser $authUser, Journalist $journalist): bool + { + return $authUser->can('Replicate:Journalist'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:Journalist'); + } +} diff --git a/app/Policies/MediaMonitoringPolicy.php b/app/Policies/MediaMonitoringPolicy.php new file mode 100644 index 0000000..48a437f --- /dev/null +++ b/app/Policies/MediaMonitoringPolicy.php @@ -0,0 +1,69 @@ +can('ViewAny:MediaMonitoring'); + } + + public function view(AuthUser $authUser, MediaMonitoring $mediaMonitoring): bool + { + return $authUser->can('View:MediaMonitoring'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:MediaMonitoring'); + } + + public function update(AuthUser $authUser, MediaMonitoring $mediaMonitoring): bool + { + return $authUser->can('Update:MediaMonitoring'); + } + + public function delete(AuthUser $authUser, MediaMonitoring $mediaMonitoring): bool + { + return $authUser->can('Delete:MediaMonitoring'); + } + + public function restore(AuthUser $authUser, MediaMonitoring $mediaMonitoring): bool + { + return $authUser->can('Restore:MediaMonitoring'); + } + + public function forceDelete(AuthUser $authUser, MediaMonitoring $mediaMonitoring): bool + { + return $authUser->can('ForceDelete:MediaMonitoring'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:MediaMonitoring'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:MediaMonitoring'); + } + + public function replicate(AuthUser $authUser, MediaMonitoring $mediaMonitoring): bool + { + return $authUser->can('Replicate:MediaMonitoring'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:MediaMonitoring'); + } +} diff --git a/app/Policies/NewsPolicy.php b/app/Policies/NewsPolicy.php new file mode 100644 index 0000000..ab3679d --- /dev/null +++ b/app/Policies/NewsPolicy.php @@ -0,0 +1,69 @@ +can('ViewAny:News'); + } + + public function view(AuthUser $authUser, News $news): bool + { + return $authUser->can('View:News'); + } + + public function create(AuthUser $authUser): bool + { + return $authUser->can('Create:News'); + } + + public function update(AuthUser $authUser, News $news): bool + { + return $authUser->can('Update:News'); + } + + public function delete(AuthUser $authUser, News $news): bool + { + return $authUser->can('Delete:News'); + } + + public function restore(AuthUser $authUser, News $news): bool + { + return $authUser->can('Restore:News'); + } + + public function forceDelete(AuthUser $authUser, News $news): bool + { + return $authUser->can('ForceDelete:News'); + } + + public function forceDeleteAny(AuthUser $authUser): bool + { + return $authUser->can('ForceDeleteAny:News'); + } + + public function restoreAny(AuthUser $authUser): bool + { + return $authUser->can('RestoreAny:News'); + } + + public function replicate(AuthUser $authUser, News $news): bool + { + return $authUser->can('Replicate:News'); + } + + public function reorder(AuthUser $authUser): bool + { + return $authUser->can('Reorder:News'); + } +}