gitlab-org--gitlab-foss/app/serializers/group_child_entity.rb
2017-10-04 22:46:49 +02:00

20 lines
620 B
Ruby

class GroupChildEntity < Grape::Entity
include ActionView::Helpers::NumberHelper
include RequestAwareEntity
expose :id, :name, :description, :visibility, :full_name, :full_path, :web_url,
:created_at, :updated_at, :star_count, :can_edit, :type, :parent_id,
:children_count, :leave_path, :edit_path, :number_projects_with_delimiter,
:number_users_with_delimiter, :permissions, :star_count
def type
object.class.name.downcase
end
def can_edit
return false unless request.respond_to?(:current_user)
can?(request.current_user, "edit_{type}", object)
end
expose
end