Example #1
0
// ListMembers gets a list of member on board accessible by the authenticated user.
func ListMembers(ctx *middleware.Context) {
	members, err := ctx.DataSource.ListMembers(ctx.Query("project_id"))

	if err != nil {
		ctx.JSON(http.StatusUnauthorized, &models.ResponseError{
			Success: false,
			Message: err.Error(),
		})
		return
	}

	ctx.JSON(http.StatusOK, members)
}
Example #2
0
// ListLabels gets a list of label on board accessible by the authenticated user.
func ListLabels(ctx *middleware.Context) {
	labels, err := models.ListLabels(ctx.User, ctx.Provider, ctx.Query("board_id"))

	if err != nil {
		ctx.JSON(http.StatusUnauthorized, &models.ResponseError{
			Success: false,
			Message: err.Error(),
		})
		return
	}

	ctx.JSON(http.StatusOK, &models.Response{
		Data: labels,
	})
}
Example #3
0
// ListComments gets a list of comment on board and card
// accessible by the authenticated user.
func ListComments(ctx *middleware.Context) {
	boards, err := models.ListComments(ctx.User, ctx.Provider, ctx.Query("project_id"), ctx.Query("issue_id"))

	if err != nil {
		ctx.JSON(http.StatusUnauthorized, &models.ResponseError{
			Success: false,
			Message: err.Error(),
		})
		return
	}

	ctx.JSON(http.StatusOK, &models.Response{
		Data: boards,
	})
}
Example #4
0
// ItemBoard gets a specific board, identified by project ID or
// NAMESPACE/BOARD_NAME, which is owned by the authenticated user.
func ItemBoard(ctx *middleware.Context) {
	board, err := models.ItemBoard(ctx.User, ctx.Provider, ctx.Query("project_id"))

	if err != nil {
		if err, ok := err.(models.ReceivedDataErr); ok {
			ctx.JSON(err.StatusCode, &models.ResponseError{
				Success: false,
				Message: err.Error(),
			})
		}
		ctx.JSON(http.StatusInternalServerError, &models.ResponseError{
			Success: false,
			Message: err.Error(),
		})
		return
	}

	ctx.JSON(http.StatusOK, &models.Response{
		Data: board,
	})
}
Example #5
0
File: auth.go Project: kesyn/kanban
// OauthUrl redirects to url for authorisation
func OauthUrl(ctx *middleware.Context) {
	ctx.Redirect(models.AuthCodeURL(ctx.Query("provider")))
}