gitlab-org--gitlab-foss/app/serializers/deploy_key_entity.rb

15 lines
438 B
Ruby
Raw Normal View History

2017-03-24 06:11:36 -04:00
class DeployKeyEntity < Grape::Entity
expose :id
expose :user_id
expose :title
expose :fingerprint
expose :can_push
expose :destroyed_when_orphaned?, as: :destroyed_when_orphaned
expose :almost_orphaned?, as: :almost_orphaned
2017-03-24 06:11:36 -04:00
expose :created_at
expose :updated_at
expose :projects, using: ProjectEntity do |deploy_key|
deploy_key.projects.select { |project| options[:user].can?(:read_project, project) }
end
end