Commit Graph

1361 Commits

Author SHA1 Message Date
Rémy Coutable 722ac5cba9 Merge branch 'grapify-labels-api' into 'master'
Grapify the labels API

Add the Grape-DSL to the labels API. Since the input validation messages are checked, two tests are modified slightly.

## What are the relevant issue numbers?

Related to #22928

See merge request !7070
2016-10-24 16:59:13 +00:00
Rémy Coutable 5cb2759429 Merge branch 'grapify-builds-api' into 'master'
Grapify builds API

## What does this MR do?

Add the Grape-DSL to the builds API.

## What are the relevant issue numbers?

Related to #22928 

The artifacts API directly downloads a file rather then returning a JSON entity.

See merge request !6877
2016-10-24 15:11:15 +00:00
Robert Schilling 21666dbe11 Grapify the labels API 2016-10-24 16:52:34 +02:00
Luis HGO f73d83db76 Added path parameter to Commits API
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-24 16:43:52 +02:00
Robert Schilling 8f527cbf06 Grapify builds API 2016-10-24 13:06:17 +02:00
Timothy Andrew 1051087ac4 Implement second round of review comments from @DouweM.
- Pass `developers_and_merge` and `developers_can_push` in `params`
  instead of using keyword arguments.

- Refactor a slightly complex boolean check to a simple `nil?` check.
2016-10-24 11:33:38 +05:30
Timothy Andrew b803bc7bb8 Implement review comments from @DouweM. 2016-10-24 11:33:38 +05:30
Timothy Andrew f79f3a1dd6 Fix branch protection API.
1. Previously, we were not removing existing access levels before
   creating new ones. This is not a problem for EE, but _is_ for CE,
   since we restrict the number of access levels in CE to 1.

2. The correct approach is:

    CE -> delete all access levels before updating a protected branch
    EE -> delete developer access levels if "developers_can_{merge,push}" is switched off

3. The dispatch is performed by checking if a "length: 1" validation is
   present on the access levels or not.

4. Another source of problems was that we didn't put multiple queries in
   a transaction. If the `destroy_all` passes, but the `update` fails,
   we should have a rollback.

5. Modifying the API to provide users direct access to CRUD access
   levels will make things a lot simpler.

6. Create `create/update` services separately for this API, which
   perform the necessary data translation, before calling the regular
   `create/update` services. The translation code was getting too large
   for the API endpoint itself, so this move makes sense.
2016-10-24 11:33:38 +05:30
Lemures Lemniscati 3a29ea9da0 Fix documents and comments on Build API `scope`. #23146 #19131 2016-10-22 03:07:26 +09:00
Rémy Coutable b4359fb24e Don't use Hash#slice since it's not supported in Ruby 2.1
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-20 19:08:46 +02:00
Douglas Barbosa Alexandre 9b28823854 List all available labels to the project on the labels API 2016-10-19 14:58:26 -02:00
Douglas Barbosa Alexandre 68f30b2fff Add support to group labels on issues board API 2016-10-19 14:58:26 -02:00
Douglas Barbosa Alexandre bf710b5119 Validate label params against all labels available to project on the API 2016-10-19 14:58:26 -02:00
Douglas Barbosa Alexandre 033ea9d1e8 Move label management to services on merge requests API 2016-10-19 14:58:26 -02:00
Douglas Barbosa Alexandre 7e11ca86fd Reuse LabelsFinder on Issueable#add_labels_by_names 2016-10-19 14:58:25 -02:00
Rémy Coutable ba2d5b1602 Merge branch 'grapify-commit-statuses-api' into 'master'
Grapify the commit status API

## What does this MR do?

Add the Grape-DSL to the commit status API.

## What are the relevant issue numbers?

Related to #22928

See merge request !6879
2016-10-19 11:46:28 +00:00
Robert Schilling c7282f8959 Grapify the commit status API 2016-10-19 12:46:27 +02:00
Rémy Coutable a96756008a Merge branch 'fix-system-hook-api' into 'master'
API: Fix Sytem hooks delete behavior

## What does this MR do?

This corrects the delete API for system hooks. Returning 200 is not the right way indicating a hooks is not found.

## What are the relevant issue numbers?

Discussed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/6861/diffs#609af00c90e3d5241064d1404e3e018a3235634a_64_62

See merge request !6883
2016-10-19 10:34:31 +00:00
Z.J. van de Weg 4de883bc81 Use GrapeDSL for commits 2016-10-18 08:21:43 +02:00
Robert Schilling 0459358103 API: Fix Sytem hooks delete behavior 2016-10-14 14:16:27 +02:00
Rémy Coutable ca3bef554b Merge branch 'grapify-boards-api' into 'master'
Grapify boards API

## What does this MR do?

Add the Grape-DSL to the boards API.

## What are the relevant issue numbers?

Related to #22928

See merge request !6876
2016-10-14 11:24:17 +00:00
Robert Schilling 4c46c9a973 Grapify boards API 2016-10-14 12:45:02 +02:00
Rémy Coutable fbeaa7518d Merge branch 'grapify-todos-api' into 'master'
Grapify todos API

## What does this MR do?

Add the Grape-DSL to the todos API.

## What are the relevant issue numbers?

Related to #22928

See merge request !6875
2016-10-14 10:29:10 +00:00
Rémy Coutable e227410b99 Merge branch 'grapify-system-hooks' into 'master'
Grapify system hooks API

## What does this MR do?

Add the Grape-DSL to the system-hook API.

## What are the relevant issue numbers?

Related to #22928

See merge request !6861
2016-10-14 09:41:13 +00:00
Robert Schilling b927473c45 Grapify todos API 2016-10-14 09:22:50 +02:00
Robert Schilling e836b904b7 Grapify system hooks API 2016-10-13 19:22:34 +02:00
Rémy Coutable 626d5e555a Merge branch 'api-order-mounts' into 'master'
Sort API mounts

## What does this MR do?

Sort the API mounts.

## Why was this MR needed?

The API mounts are unsorted.

See merge request !6831
2016-10-13 16:03:22 +00:00
Sean McGivern 11e93ad59d Merge branch 'feature/issues-board' into 'master'
Refactoring Issues Board

## What does this MR do?

This MR aims to minimize conflicts between the CE issues board feature with EE multiple boards feature.

## Are there points in the code the reviewer needs to double check?

## Why was this MR needed?

To avoid a lot of conflicts with EE multiple boards feature.

## Screenshots (if relevant)

## Does this MR meet the acceptance criteria?

- [ ] ~~[CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added~~
- [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [x] API support added
- Tests
  - [X] Added for this feature/bug
  - [ ] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [X] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

https://gitlab.com/gitlab-org/gitlab-ee/issues/929

https://gitlab.com/gitlab-org/gitlab-ee/issues/1084

See merge request !6727
2016-10-13 14:21:14 +00:00
Rémy Coutable 8fe2e345d7 Merge branch 'zj-grapedsl-variable' into 'master'
GrapeDSL for variables



See merge request !6838
2016-10-13 13:38:02 +00:00
Robert Schilling 2273b5d6d6 Sort API mounts 2016-10-13 12:52:51 +02:00
Z.J. van de Weg 3d6f18cec5 GrapeDSL for variables 2016-10-13 09:55:50 +02:00
Robert Speicher 58e2b44afe Merge branch 'api-version' into 'master'
API: Version information

## What does this MR do?

Adds a new endpoint to retrieve the version information.

## Why was this MR needed?

Clients can now use this information to enable/disable certain API features depending on the version.  

## What are the relevant issue numbers?

Closes #22608, https://gitlab.com/gitlab-org/gitlab-ce/issues/23148

See merge request !6822
2016-10-12 18:38:02 +00:00
Rémy Coutable 3c31f185b9 Merge branch '17541-move-licenses-api-endpoint-to-templates-licenses' into 'master'
Resolve "Move `/licenses` api endpoint to `/templates/licenses`"

## What does this MR do?

It moves the `/licenses`, `/gitignores` and `/gitlab_ci_ymls` API endpoints under the `/templates` namespace

## Why was this MR needed?

In EE we now have somewhat ambiguous API endpoints. `/license` refers to the EE license while `/licenses` (plural) refers to license templates. @DouweM mentioned that we're adding .gitignore templates in #14106 so it may make sense to add a /templates namespace. Then, move the /license templates endpoint to be underneath, along with .gitignore endpoints. 

Closes #17541

See merge request !5717
2016-10-12 15:03:21 +00:00
Robert Schilling b998479c81 API: Version information 2016-10-12 16:47:35 +02:00
Robert Speicher 7c07c07d7a Merge branch 'user-events-api' into 'master'
API: New /users/:id/events endpoint

## What does this MR do?

If add a new `/users/:id/events` endpoint to retrieve a user's contribution events. The events returned are filtered so that only the events for projects that the current user can see are returned (similarly to what we do at the controller level).

## Why was this MR needed?

Because it's a nice feature to calculate leaderboards, for instance for #17815.

## What are the relevant issue numbers?

Closes #20866.

See merge request !6771
2016-10-12 11:33:19 +00:00
Thomas Balthazar b9b13ea801 Create a new /templates API namespace
The /licenses, /gitignores and /gitlab_ci_ymls endpoints are now also
available under a new /templates namespace. Old endpoints will be
deprecated when GitLab 9.0.0 is released.
2016-10-12 11:09:41 +02:00
Rémy Coutable 670b2eb5c0
Merge branch 'api-fix-project-group-sharing' into 'security'
API: Share projects only with groups current_user can access

Aims to address the issues here: https://gitlab.com/gitlab-org/gitlab-ce/issues/23004

* Projects can be shared with non-existent groups
* Projects can be shared with groups that the current user does not have access to read

Concerns:

The new implementation of the API endpoint allows projects to be shared with a larger range of groups than can be done via the web UI.

The form for sharing a project with a group uses the following API endpoint to index the available groups: 494269fc92/lib/api/groups.rb (L17). The groups indexed in the web form will only be those groups that the user is currently a member of.

The new implementation allows projects to be shared with any group that the authenticated user has access to view. This widens the range of groups to those that are public and internal.

See merge request !2005

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-11 20:36:26 +02:00
Douglas Barbosa Alexandre e171c1d80d Update Issue Board API to handle with has_many association 2016-10-11 11:39:05 -03:00
Dmitriy Zaporozhets 137ebcfb3c Replace undefined Grape routing code from 400 to 404
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-10-10 16:32:32 +03:00
Dmitriy Zaporozhets d6cfc0042e Catch any undefined API routing and return 400 Bad Request
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-10-10 16:32:32 +03:00
Rémy Coutable 33ce197645
API: New /users/:id/events endpoint
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-10 13:35:53 +02:00
Rémy Coutable 0876b46024 Merge branch 'memoize_shell_secret_token' into 'master'
Memoize Github::Shell's secret token

## What does this MR do?

`API::Helpers#secret_token` was reading the secret file on every invocation. This MR reads the file in the `gitlab_shell_secret_token.rb` initializer and saves it as a class variable at `Gitlab::Shell.secret_token`

## Are there points in the code the reviewer needs to double check?

 - I'm not sure if the use of `cattr_accessor` is the best approach, or if should be moved into the `class << self` block?
 - Should `API::Helpers#secret_token` be removed in favor of using `Gitlab::Shell.secret_token`?

## Why was this MR needed?

Performance optimization.

Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/22510

See merge request !6599
2016-10-07 10:35:03 +00:00
Rémy Coutable 1be1516217 Merge branch 'ben.boeckel/gitlab-ce-api-visible-projects' into 'master'
Add visible projects API

## What does this MR do?

Add a new `/projects/visible` API endpoint. Originally created by @ben.boeckel in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5970.

## Are there points in the code the reviewer needs to double check?

Does the API make sense?

## Why was this MR needed?

The `/projects` endpoint only returned projects the user was explicitly a member of.

Closes #19361, #3119.

See merge request !6681
2016-10-07 09:54:44 +00:00
Justin DiPierro fe46e4eb35 Load Github::Shell's secret token from file on initialization instead of every request. 2016-10-06 11:22:37 -04:00
Nick Thomas 86c0c0869d Switch from request to env in ::API::Helpers
Per https://gitlab.com/gitlab-org/gitlab-ce/issues/22820, this helper is mixed
in to classes that lack a `request` method. They do include `env`, so use it
instead.
2016-10-06 15:07:25 +01:00
Robert Speicher 8a96910cf5 Merge branch 'rc-use-grape-dsl-to-document-members-api' into 'master'
API: Use Grape DSL to document access requests and members endpoints

Part of #21979, depends on gitlab-org/gitlab-ce!6267 and gitlab-org/gitlab-ce!6266.

See merge request !6269
2016-10-06 12:41:31 +00:00
Rémy Coutable 5bdd8c3e3e Merge branch 'mahcsig/gitlab-ce-17350-multi-file-commit'
See !6096.
2016-10-06 13:41:16 +02:00
Dmitriy Zaporozhets ab18d6b7a9 Merge branch 'issue-board-api-support' into 'master'
Issue Board API support

## What does this MR do?

Adds support for Issue Board in the API.

## Are there points in the code the reviewer needs to double check?

~~Double check whether the Issue Board list movement fix is needed.~~ 

*Moved to a separate issue.* [#22890](https://gitlab.com/gitlab-org/gitlab-ce/issues/22890)

## Why was this MR needed?

Currently the API offers partial support to a project's Issue Board indirectly through Labels.
This MR adds support for listing, creating, moving and removing board lists.

## Does this MR meet the acceptance criteria?

- [X] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [X] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [X] API support added
- Tests
  - [X] Added for this feature/bug
  - [X] All builds are passing
- [X] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [X] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [X] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [X] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?
[#22195](https://gitlab.com/gitlab-org/gitlab-ce/issues/22195)

See merge request !6646
2016-10-06 11:40:03 +00:00
Rémy Coutable d51bb99a7e
Merge commit 'dev/security' into 'master'
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-06 08:33:11 +02:00
Marc Siegfriedt a1ee8cf5ad multi-file commit
add docs and tests - add additional validation
allow move without content
updated response
2016-10-05 17:42:52 +00:00