You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
754 B
19 lines
754 B
api.array :memberships, api_meta(:total_count => @member_count, :offset => @offset, :limit => @limit) do
|
|
@members.each do |membership|
|
|
api.membership do
|
|
api.id membership.id
|
|
api.project :id => membership.project.id, :name => membership.project.name
|
|
api.__send__ membership.principal.class.name.underscore, :id => membership.principal.id, :name => membership.principal.name
|
|
api.array :roles do
|
|
membership.member_roles.each do |member_role|
|
|
if member_role.role
|
|
attrs = {:id => member_role.role.id, :name => member_role.role.name}
|
|
attrs.merge!(:inherited => true) if member_role.inherited_from.present?
|
|
api.role attrs
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|