debian-mirror-gitlab/app/controllers/projects/boards_controller.rb

38 lines
778 B
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
class Projects::BoardsController < Projects::ApplicationController
2016-11-03 12:29:30 +05:30
include IssuableCollections
2016-09-13 17:45:13 +05:30
2016-11-03 12:29:30 +05:30
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-09-13 17:45:13 +05:30
def show
2016-11-03 12:29:30 +05:30
@board = project.boards.find(params[:id])
respond_to do |format|
format.html
format.json do
render json: serialize_as_json(@board)
end
end
2016-09-13 17:45:13 +05:30
end
private
def authorize_read_board!
return access_denied! unless can?(current_user, :read_board, project)
end
2016-11-03 12:29:30 +05:30
def serialize_as_json(resource)
resource.as_json(only: [:id])
end
2016-09-13 17:45:13 +05:30
end