gitlab-org--gitlab-foss/app/controllers/projects/boards_controller.rb

38 lines
778 B
Ruby
Raw Normal View History

2016-08-01 12:09:41 -04:00
class Projects::BoardsController < Projects::ApplicationController
2016-08-30 09:50:46 -04:00
include IssuableCollections
before_action :authorize_read_board!, only: [:index, :show]
def index
@boards = ::Boards::ListService.new(project, current_user).execute
respond_to do |format|
format.html
format.json do
render json: serialize_as_json(@boards)
end
end
end
2016-08-01 12:09:41 -04:00
def show
@board = project.boards.find(params[:id])
respond_to do |format|
format.html
format.json do
render json: serialize_as_json(@board)
end
end
2016-08-01 12:09:41 -04:00
end
private
def authorize_read_board!
return access_denied! unless can?(current_user, :read_board, project)
end
def serialize_as_json(resource)
2016-10-10 22:29:20 -04:00
resource.as_json(only: [:id])
end
2016-08-01 12:09:41 -04:00
end