diff options
Diffstat (limited to 'app/serializers/environment_entity.rb')
-rw-r--r-- | app/serializers/environment_entity.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/serializers/environment_entity.rb b/app/serializers/environment_entity.rb index d9af7af8a8b..7da5910a75b 100644 --- a/app/serializers/environment_entity.rb +++ b/app/serializers/environment_entity.rb @@ -28,6 +28,10 @@ class EnvironmentEntity < Grape::Entity cancel_auto_stop_project_environment_path(environment.project, environment) end + expose :delete_path do |environment| + environment_delete_path(environment) + end + expose :cluster_type, if: ->(environment, _) { cluster_platform_kubernetes? } do |environment| cluster.cluster_type end @@ -63,6 +67,10 @@ class EnvironmentEntity < Grape::Entity environment.elastic_stack_available? end + expose :can_delete do |environment| + can?(current_user, :destroy_environment, environment) + end + private alias_method :environment, :object |