Permalink
Browse files

respond to MEMBER-DELETE request

  • Loading branch information...
rekado committed Sep 30, 2012
1 parent debf4fb commit a6afe64c9c13a9335980dd28fa40e2671eaaf075
Showing with 22 additions and 0 deletions.
  1. +22 −0 lib/libertree/server/responder/member.rb
@@ -57,6 +57,28 @@ def rsp_member(params)
respond_with_code 'ERROR'
end
end
def rsp_member_delete(params)
return if require_parameters(params, 'member_id')
begin
members = Model::Member.
where( 'id' => params['member_id'] ).
reject { |p| p.server != @server }
if members.empty?
respond( {
'code' => 'NOT FOUND',
'message' => "Unrecognized member ID: #{params['member_id'].inspect}"
} )
else
members[0].delete_cascade # there should only be one member
respond_with_code 'OK'
end
rescue PGError => e
respond_with_code 'ERROR'
end
end
end
end
end

0 comments on commit a6afe64

Please sign in to comment.