diff options
Diffstat (limited to 'app/serializers/cluster_basic_entity.rb')
-rw-r--r-- | app/serializers/cluster_basic_entity.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/serializers/cluster_basic_entity.rb b/app/serializers/cluster_basic_entity.rb new file mode 100644 index 00000000000..d104f2c8bbd --- /dev/null +++ b/app/serializers/cluster_basic_entity.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class ClusterBasicEntity < Grape::Entity + include RequestAwareEntity + + expose :name + expose :path, if: -> (cluster) { can?(request.current_user, :read_cluster, cluster) } do |cluster| + cluster.present(current_user: request.current_user).show_path + end +end |