diff --git a/app/Filament/Resources/AirportGroupResource/RelationManagers/AirportsRelationManager.php b/app/Filament/Resources/AirportGroupResource/RelationManagers/AirportsRelationManager.php index f5d824c8..8aacc951 100644 --- a/app/Filament/Resources/AirportGroupResource/RelationManagers/AirportsRelationManager.php +++ b/app/Filament/Resources/AirportGroupResource/RelationManagers/AirportsRelationManager.php @@ -22,11 +22,6 @@ protected function canDelete(Model $record): bool return false; } - protected function canDeleteAny(): bool - { - return false; - } - public static function form(Form $form): Form { return $form diff --git a/app/Filament/Resources/AirportResource/RelationManagers/GroupsRelationManager.php b/app/Filament/Resources/AirportResource/RelationManagers/GroupsRelationManager.php index f1dac36d..6a158303 100644 --- a/app/Filament/Resources/AirportResource/RelationManagers/GroupsRelationManager.php +++ b/app/Filament/Resources/AirportResource/RelationManagers/GroupsRelationManager.php @@ -20,11 +20,6 @@ protected function canDelete(Model $record): bool return false; } - protected function canDeleteAny(): bool - { - return false; - } - public static function form(Form $form): Form { return $form diff --git a/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/EventsRelationManager.php b/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/EventsRelationManager.php index 85bf7be7..d53b8119 100644 --- a/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/EventsRelationManager.php +++ b/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/EventsRelationManager.php @@ -19,11 +19,6 @@ class EventsRelationManager extends HasManyRelationManager protected static ?string $recordTitleAttribute = 'name'; - private static function setFirOptions(Collection $firs) - { - return $firs->mapWithKeys(fn (FlightInformationRegion $fir) => [$fir->id => $fir->identifierName]); - } - public static function form(Form $form): Form { return $form diff --git a/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/UsersRelationManager.php b/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/UsersRelationManager.php index 0b509753..8118abca 100644 --- a/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/UsersRelationManager.php +++ b/app/Filament/Resources/FlightInformationRegionResource/RelationManagers/UsersRelationManager.php @@ -27,11 +27,6 @@ protected function canDelete(Model $record): bool return false; } - protected function canDeleteAny(): bool - { - return false; - } - protected function canEdit(Model $record): bool { // TODO: Might add role stuff here diff --git a/app/Filament/Resources/UserResource/RelationManagers/FlightInformationRegionsRelationManager.php b/app/Filament/Resources/UserResource/RelationManagers/FlightInformationRegionsRelationManager.php index a8a8b9de..235a3ca7 100644 --- a/app/Filament/Resources/UserResource/RelationManagers/FlightInformationRegionsRelationManager.php +++ b/app/Filament/Resources/UserResource/RelationManagers/FlightInformationRegionsRelationManager.php @@ -20,11 +20,6 @@ protected function canDelete(Model $record): bool return false; } - protected function canDeleteAny(): bool - { - return false; - } - public static function form(Form $form): Form { return $form diff --git a/app/Policies/AirportGroupPolicy.php b/app/Policies/AirportGroupPolicy.php index 43774b86..85d6a39a 100644 --- a/app/Policies/AirportGroupPolicy.php +++ b/app/Policies/AirportGroupPolicy.php @@ -113,4 +113,14 @@ public function forceDelete(User $user, AirportGroup $airportGroup) RoleKey::NMT, ]); } + + public function deleteAny() + { + return false; + } + + public function detachAny() + { + return false; + } } diff --git a/app/Policies/AirportPolicy.php b/app/Policies/AirportPolicy.php index 603d138f..a128fee9 100644 --- a/app/Policies/AirportPolicy.php +++ b/app/Policies/AirportPolicy.php @@ -113,4 +113,14 @@ public function forceDelete(User $user, Airport $airport) RoleKey::NMT, ]); } + + public function deleteAny() + { + return false; + } + + public function detachAny() + { + return false; + } } diff --git a/app/Policies/DiscordTagPolicy.php b/app/Policies/DiscordTagPolicy.php new file mode 100644 index 00000000..fb8e88b2 --- /dev/null +++ b/app/Policies/DiscordTagPolicy.php @@ -0,0 +1,126 @@ +role->key, [ + RoleKey::SYSTEM, + RoleKey::NMT, + ]); + } + + /** + * Determine whether the user can view the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordTag $discordTag + * @return \Illuminate\Auth\Access\Response|bool + */ + public function view(User $user, DiscordTag $discordTag) + { + return in_array($user->role->key, [ + RoleKey::SYSTEM, + RoleKey::NMT, + ]); + } + + /** + * Determine whether the user can create models. + * + * @param \App\Models\User $user + * @return \Illuminate\Auth\Access\Response|bool + */ + public function create(User $user) + { + return in_array($user->role->key, [ + RoleKey::SYSTEM, + RoleKey::NMT, + ]); + } + + /** + * Determine whether the user can update the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordTag $discordTag + * @return \Illuminate\Auth\Access\Response|bool + */ + public function update(User $user, DiscordTag $discordTag) + { + return in_array($user->role->key, [ + RoleKey::SYSTEM, + RoleKey::NMT, + ]); + } + + /** + * Determine whether the user can delete the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordTag $discordTag + * @return \Illuminate\Auth\Access\Response|bool + */ + public function delete(User $user, DiscordTag $discordTag) + { + return in_array($user->role->key, [ + RoleKey::SYSTEM, + RoleKey::NMT, + ]); + } + + /** + * Determine whether the user can restore the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordTag $discordTag + * @return \Illuminate\Auth\Access\Response|bool + */ + public function restore(User $user, DiscordTag $discordTag) + { + return in_array($user->role->key, [ + RoleKey::SYSTEM, + RoleKey::NMT, + ]); + } + + /** + * Determine whether the user can permanently delete the model. + * + * @param \App\Models\User $user + * @param \App\Models\DiscordTag $discordTag + * @return \Illuminate\Auth\Access\Response|bool + */ + public function forceDelete(User $user, DiscordTag $discordTag) + { + return in_array($user->role->key, [ + RoleKey::SYSTEM, + RoleKey::NMT, + ]); + } + + public function deleteAny() + { + return false; + } + + public function detachAny() + { + return false; + } +} diff --git a/app/Policies/EventPolicy.php b/app/Policies/EventPolicy.php index cb775eb2..15c28e11 100644 --- a/app/Policies/EventPolicy.php +++ b/app/Policies/EventPolicy.php @@ -118,4 +118,14 @@ public function forceDelete(User $user, Event $event) RoleKey::FLOW_MANAGER, ]); } + + public function deleteAny() + { + return false; + } + + public function detachAny() + { + return false; + } } diff --git a/app/Policies/FlightInformationRegionPolicy.php b/app/Policies/FlightInformationRegionPolicy.php index 26192f8e..67e4a086 100644 --- a/app/Policies/FlightInformationRegionPolicy.php +++ b/app/Policies/FlightInformationRegionPolicy.php @@ -113,4 +113,14 @@ public function forceDelete(User $user, FlightInformationRegion $flightInformati RoleKey::NMT, ]); } + + public function deleteAny() + { + return false; + } + + public function detachAny() + { + return false; + } } diff --git a/app/Policies/FlowMeasurePolicy.php b/app/Policies/FlowMeasurePolicy.php index 11a3abfc..1c77f017 100644 --- a/app/Policies/FlowMeasurePolicy.php +++ b/app/Policies/FlowMeasurePolicy.php @@ -122,4 +122,14 @@ public function forceDelete(User $user, FlowMeasure $flowMeasure) RoleKey::NMT, ]); } + + public function deleteAny() + { + return false; + } + + public function detachAny() + { + return false; + } } diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index 7f46fdd1..7e52ce1c 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -104,4 +104,14 @@ public function forceDelete(User $user, User $model) { return false; } + + public function deleteAny() + { + return false; + } + + public function detachAny() + { + return false; + } }