Commit Graph

1004 Commits

Author SHA1 Message Date
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
Robert Speicher c0c45c72a8 Merge branch 'speed-up-api-projects-spec' into 'master'
Speed up specs for GET /projects/:id/events

## What does this MR do?

Just groups some expectations into a single `it` block. Reduce this particular tests block time by half.

See merge request !6778
2016-10-12 10:23:39 +00:00
Douwe Maan d1eab555b6 Merge branch '20708-new-branch-is-immediatelly-tagged-as-merged' into 'master'
Removes inconsistency regarding tagging immediately as merged once you create a …

- [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?


Closes #20708

See merge request !6408
2016-10-12 10:17:35 +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 c786578657
Make spec deterministic
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-11 21:26:49 +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
tiagonbotelho c90483406e refactors tests because of gitlab-test repository changes 2016-10-11 16:33:06 +01:00
Rémy Coutable 8e70cf2564
Addresses Robert's feedback
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-11 17:25:57 +02:00
Rémy Coutable 4917bbd7ff
Speed up specs for GET /projects/:id/events
From 8.15s to 4.55s by grouping expectations

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-10 17:07:58 +02:00
Dmitriy Zaporozhets 3e49123dd5 Fix api users spec for post request with invalid id
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-10-10 16:32:32 +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 fdfc93679d Fix API specs behaviour for invalid routing
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 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
Nick Thomas e94cd6fdfe Add markdown cache columns to the database, but don't use them yet
This commit adds a number of _html columns and, with the exception of Note,
starts updating them whenever the content of their partner fields changes.

Note has a collision with the note_html attr_accessor; that will be fixed later

A background worker for clearing these cache columns is also introduced - use
`rake cache:clear` to set it off. You can clear the database or Redis caches
separately by running `rake cache:clear:db` or `rake cache:clear:redis`,
respectively.
2016-10-07 02:54: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
Andre Guedes 41d70ea300 Added Issue Board API support
- Includes documentation and tests
2016-10-05 13:12:07 -03:00
Rémy Coutable 84b7dd763b Use Grape DSL to document methods and their params
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-05 11:20:27 +02:00
barthc 35ced4dae4 fix group links 404 2016-10-05 09:57:54 +01:00
Sean McGivern 42cb659726 Update API docs and specs for /projects/visible 2016-10-04 17:46:08 +01:00
Ben Boeckel e956a24dfd api: add /projects/visible API endpoint
FIxes #19361, #3119.
2016-10-04 17:23:18 +01:00
Rémy Coutable e9d7b4f765 Invert method's naming
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-03 16:57:48 +02:00
Rémy Coutable 3158f57dba Improve Members::DestroyService
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-10-03 16:57:48 +02:00
Robert Speicher e64594ac44 Merge branch '21983-member-add_user-doesn-t-detect-existing-members-that-have-requested-access' into 'master'
Resolve "`Member.add_user`doesn't detect existing members that have requested access"

## What does this MR do?

This merge request handle the case when an access requester is added to a group or project (via the members page or the API).

In `Member.add_user`, if an access requester already exists, we simply accept their request (and set the `created_by`, `access_level` and `expires_at` attributes if given).

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

I've taken the opportunity to cleanup the whole `{Group,Project}Member.add_user*` methods since it was quite a mess.

## What are the relevant issue numbers?

Closes #21983

See merge request !6393
2016-10-02 11:42:57 +00:00
Robert Speicher 076e040639 Merge branch 'rc-new-members-request-access-service' into 'master'
New `Members::RequestAccessService`

Part of #21979.

See merge request !6265
2016-10-02 11:33:06 +00:00
Robert Speicher 4f92f29e70 Merge branch 'koding-setting-api' into 'master'
Expose the Koding application settings in the API

## Why was this MR needed?

When saving the GitLab application secrets in Koding, and authorising your admin user to have access to the UI, we want to let Koding enable the integration, and populate the url in GitLab for the user.

## What are the relevant issue numbers?

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

See merge request !6555
2016-09-30 11:06:08 +00:00
Makoto Scott-Hinkle 82b13a21a6 Allowing ">" to be used for Milestone models's title and storing the value in db as unescaped.
Updating test value for milestone title

Adding API test for title with reserved HTML characters.

Updating changelog

Adding the MR number for fixing bug #22452.

removing duplicate line

Updating MR number.
2016-09-29 19:28:38 -07:00
DJ Mountney 59157c0423 Expose the Koding application settings in the API
This will allow the Koding app to enable the integration itself once is has authorized an admin user using the application secrets.
2016-09-29 09:12:52 -07:00
Rémy Coutable f6a1a21f6f Merge branch 'issue_22382' into 'master'
Expose project share expiration_date field on API

closes #22382

See merge request !6484
2016-09-29 13:04:16 +00:00
Rémy Coutable dbfcccaf77 Merge branch '22367-add-pipeline-id-build' into 'master'
Expose pipeline data in builds API

Exposes pipeline data in builds API, as suggested by #22367.
The fields exposed were 'id', 'status', 'ref', and 'sha'.

Closes #22367

See merge request !6502
2016-09-29 08:46:48 +00:00
Guilherme Salazar e80e4cb8b9 expose pipeline data in builds API
add pipeline ref, sha, and status to the build API response

add tests of build API (pipeline data)

change API documentation for builds API

log change to builds API in CHANGELOG

CHANGELOG: add reference to pull request and contributor's name
2016-09-28 23:58:16 -03:00
Patricio Cano 2772109ac1 Handle LFS token creation and retrieval in the same method, and in the same Redis connection.
Reset expiry time of token, if token is retrieved again before it expires.
2016-09-28 12:13:48 -05:00
Douwe Maan a4cddd81f1 Merge branch '22435-no-api-state-change-via-rails-session' into 'security'
API: disable rails session auth for non-GET/HEAD requests

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/22435

See merge request !1999
2016-09-28 14:44:11 +00:00
Felipe Artur 93d849beae Expose project share expiration_date field on API 2016-09-28 10:12:49 -03:00
Rémy Coutable ec0061a95c Allow Member.add_user to handle access requesters
Changes include:

- Ensure Member.add_user is not called directly when not necessary
- New GroupMember.add_users_to_group to have the same abstraction level as for Project
- Refactor Member.add_user to take a source instead of an array of members
- Fix Rubocop offenses
- Always use Project#add_user instead of project.team.add_user
- Factorize users addition as members in Member.add_users_to_source
- Make access_level a keyword argument in GroupMember.add_users_to_group and ProjectMember.add_users_to_projects
- Destroy any requester before adding them as a member
- Improve the way we handle access requesters in Member.add_user
  Instead of removing the requester and creating a new member,
  we now simply accepts their access request. This way, they will
  receive a "access request granted" email.
- Fix error that was previously silently ignored
- Stop raising when access level is invalid in Member, let Rails validation do their work

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-28 09:43:00 +02:00
Nick Thomas 3ed80a0176 Enforce the fork_project permission in Projects::CreateService
Projects::ForkService delegates to this service almost entirely, but needed
one small change so it would propagate create errors correctly.

CreateService#execute needs significant refactoring; it is now right at the
complexity limit set by Rubocop. I avoided doing so in this commit to keep the
diff as small as possible.

Several tests depend on the insecure behaviour of ForkService, so fi them up at
the same time.
2016-09-27 13:17:56 +01:00
Dmitriy Zaporozhets 0614cf1954
Add extra check for api users spec
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-09-27 14:46:39 +03:00
Dmitriy Zaporozhets c17383a730 Improvements to user organization field feature after code review
* Add newline to user organization spec according to test guide
* Remove unnecessary comments from user organization database migration

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-09-27 14:04:39 +03:00
Dmitriy Zaporozhets d0b556eb1b Add User#organization to users api
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-09-27 14:04:39 +03:00
Nick Thomas fd51f19c97 API: disable rails session auth for non-GET/HEAD requests 2016-09-23 12:21:47 +01:00
Rémy Coutable 7458126111 API: Return 404 when trying to fork to unaccessible namespace
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-22 12:15:45 +02:00
Rémy Coutable 6b02127f03 New Members::RequestAccessService
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-22 11:12:17 +02:00