Sha256: 456f4824f537291119a31880118f4c8f8a663b2175e8996249e8e8db57f7f09b

Contents?: true

Size: 979 Bytes

Versions: 4

Compression:

Stored size: 979 Bytes

Contents

# Controller for /ws/conference/{id}/attendees
# origin: M
class Ws::AttendeesController < Ws::ApiController

  public_actions :index

  def index
    conference = Conference.find(params[:conference_id])
    attendees = conference.attendees
    if attendees.any?
      render :json => format_users(conference.attendees)
    else
      render_no_content
    end
  end

  def create
    conference = Conference.find(params[:conference_id])
    api_user.may_attend_conference!(conference)
    username = json_params['username']
    if username != api_user.username
      raise Aegis::AccessDenied
    end

    conference.attend!(api_user)

    render_no_content
  end

  def destroy
    conference = Conference.find(params[:conference_id])
    api_user.may_cancel_attendance_conference!(conference)
    username = params[:id]
    if username != api_user.username
      raise Aegis::AccessDenied
    end

    conference.cancel_attendance!(api_user)

    render_no_content
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serum-rails-0.2.1 spec/test_apps/rails-2-3/app/controllers/ws/attendees_controller.rb
serum-rails-0.2.0 spec/test_apps/rails-2-3/app/controllers/ws/attendees_controller.rb
serum-rails-0.1.1 spec/test_app/app/controllers/ws/attendees_controller.rb
serum-rails-0.1.0 spec/test_app/app/controllers/ws/attendees_controller.rb