Redmine/app/views/members/index.api.rsb

19 lines
754 B
Plaintext

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