summaryrefslogtreecommitdiff
path: root/app/controllers/api/v1/switchboards_controller.rb
blob: 4d6607ac9cbad13dbe53045f3b6ad49043fee2c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Api
  module V1
    class SwitchboardsController < ApplicationController
      respond_to :json

      def index
        @user = current_user
        @switchboards = Switchboard.all

        if can? :read, @switchboards
          respond_with @switchboards
        end
      end

      def show
        @user = current_user
        @switchboard = Switchboard.find(params[:id])

        if can? :read, @switchboard
          respond_with @switchboard
        end
      end
    end
  end
end