diff --git a/app/Livewire/Project/Shared/Danger.php b/app/Livewire/Project/Shared/Danger.php index 2ed764cd1..158549b06 100644 --- a/app/Livewire/Project/Shared/Danger.php +++ b/app/Livewire/Project/Shared/Danger.php @@ -24,6 +24,7 @@ public function mount() public function delete() { try { + // $this->authorize('delete', $this->resource); $this->resource->delete(); DeleteResourceJob::dispatch($this->resource, $this->delete_configurations); return redirect()->route('project.resource.index', [ diff --git a/app/Policies/ApplicationPolicy.php b/app/Policies/ApplicationPolicy.php new file mode 100644 index 000000000..860479a94 --- /dev/null +++ b/app/Policies/ApplicationPolicy.php @@ -0,0 +1,69 @@ +isAdmin()) { + return true; + } + return false; + } + + /** + * Determine whether the user can restore the model. + */ + public function restore(User $user, Application $application): bool + { + return true; + } + + /** + * Determine whether the user can permanently delete the model. + */ + public function forceDelete(User $user, Application $application): bool + { + return true; + } +} diff --git a/app/Policies/ServicePolicy.php b/app/Policies/ServicePolicy.php new file mode 100644 index 000000000..93882be9a --- /dev/null +++ b/app/Policies/ServicePolicy.php @@ -0,0 +1,79 @@ +isAdmin()) { + return true; + } + return false; + } + + /** + * Determine whether the user can restore the model. + */ + public function restore(User $user, Service $service): bool + { + return true; + } + + /** + * Determine whether the user can permanently delete the model. + */ + public function forceDelete(User $user, Service $service): bool + { + if ($user->isAdmin()) { + return true; + } + return false; + } + public function stop(User $user, Service $service): bool + { + if ($user->isAdmin()) { + return true; + } + return false; + } +}