Commit Graph

1579 Commits

Author SHA1 Message Date
Rémy Coutable 4c34331084 Merge branch 'fix-users-api-500-error' into 'master'
Fix 500 errors when creating a user with identity via API

Closes #26295

See merge request !8442
2017-01-06 11:16:00 +00:00
Rémy Coutable 3b8c81fe9e Merge branch '19966-api-call-to-move-project-to-different-group-fails-when-using-group-and-project-names-instead-of-id' into 'master'
Fix groups API to accept path when transferring a project

Closes #19966

See merge request !8408
2017-01-05 18:10:24 +00:00
Rémy Coutable 036cafa95a Merge branch '26261-post-api-v3-projects-idorproject-commits-commits-does-not-work-with-project-path' into 'master'
Fix Commits API to accept a Project path upon POST

Closes #26261

See merge request !8406
2017-01-05 18:06:46 +00:00
Rémy Coutable 8b1914ceb2
Fix the failing spec in POST /users API
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-05 13:30:31 +01:00
Kamil Trzciński b1cd9add23 Merge branch 'zj-404-slack-error' into 'master'
Add API route slack slash commands

Closes #25954

See merge request !8362
2017-01-05 11:09:26 +00:00
Sean McGivern 034d2e4e74 Merge branch 'api-refactor-issues-filter' into 'master'
Refactor issues filter in API

See merge request !8432
2017-01-04 11:08:19 +00:00
Robert Schilling 0199f1861b Add missing milestone parameter 2017-01-04 10:07:00 +01:00
Robert Schilling dc6b35e1ae Refactor issues filter in API 2017-01-04 09:50:09 +01:00
Robert Schilling 2448fa69d6 Fix project hooks params 2017-01-03 21:07:12 +01:00
Z.J. van de Weg dfca704d6a Add API route slack slash commands 2017-01-03 20:34:35 +01:00
Mark Fletcher b5f4fc843a Fix groups API to accept path when transferring a project
* Use standard helpers for finding group and project
2017-01-03 09:25:56 +00:00
Robert Schilling 15932c360c API: extern_uid is a string 2017-01-03 08:44:33 +01:00
Mark Fletcher 63fcf13739 Fix Commits API to accept a Project path upon POST 2017-01-03 01:16:38 +00:00
Sean McGivern 714f70a38d Merge branch 'grapify-settings-api' into 'master'
Grapify the settings API

See merge request !8336
2016-12-29 15:59:31 +00:00
Robert Schilling ec7485de21 Grapify the settings API 2016-12-29 11:24:15 +01:00
Sean McGivern 6892216f5f Merge branch 'clean-api-params' into 'master'
Parameter already enforced via grape

See merge request !8344
2016-12-28 15:22:11 +00:00
Robert Schilling 2ac92662ea Parameter already enforced via grape 2016-12-28 12:40:39 +01:00
Robert Schilling 465700ddc2 Merge branch 'fix-api-deprecation' into 'master'
Fix a Grape deprecation, use `#request_method` instead of `#route_method`

See merge request !8297
2016-12-28 11:36:28 +00:00
Douwe Maan 20afb4c69e Merge branch 'feature/1376-allow-write-access-deploy-keys' into 'master'
Allow to add deploy keys with write-access

Closes #1376

See merge request !7383
2016-12-27 15:00:49 +00:00
Sean McGivern 0ebd50ce00 Merge branch 'feature/more-storage-statistics' into 'master'
Add more storage statistics

See merge request !7754
2016-12-26 09:48:30 +00:00
Rémy Coutable 1b109c99a4
Fix a Grape deprecation, use `#request_method` instead of `#route_method`
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-23 19:07:23 +01:00
Rémy Coutable f9e59516a2 Merge branch 'fixes-issues-api-reopen' into 'master'
Fix state_event parameter to reopen an issue

Closes #25958

See merge request !8246
2016-12-23 09:12:40 +00:00
Yorick Peterse a1aa0d7829 Merge branch 'cache-last-commit-sha-for-path' into 'master'
Cache last commit id for path

See merge request !8098
2016-12-22 13:22:07 +00:00
Robert Schilling 5961d14292 Fix state_event parameter to reopen an issue 2016-12-22 09:41:53 +01:00
Markus Koller 3ef4f74b1a
Add more storage statistics
This adds counters for build artifacts and LFS objects, and moves
the preexisting repository_size and commit_count from the projects
table into a new project_statistics table.

The counters are displayed in the administration area for projects
and groups, and also available through the API for admins (on */all)
and normal users (on */owned)

The statistics are updated through ProjectCacheWorker, which can now
do more granular updates with the new :statistics argument.
2016-12-21 16:39:49 +01:00
Markus Koller d5c4977912
Consistently use current_user in API entities 2016-12-21 16:36:53 +01:00
Markus Koller d05dd81b99
Don't expose all namespace fields in API 2016-12-21 16:36:53 +01:00
Sean McGivern b86f45004e Merge branch 'fix/25843' into 'master'
Rename SlackNotificationService back to SlackService

## What does this MR do?

See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8191#note_20310845

## What are the relevant issue numbers?

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

/cc @yorickpeterse @stanhu @smcgivern @felipe_artur @ayufan

See merge request !8208
2016-12-20 23:12:25 +00:00
Douglas Barbosa Alexandre d1bf557aac Rename MattermostNotificationService back to MattermostService 2016-12-20 19:42:13 -02:00
Douglas Barbosa Alexandre fed29117de Rename SlackNotificationService back to SlackService 2016-12-20 19:42:13 -02:00
Rémy Coutable 5652da8bb4 Allow unauthenticated access to Repositories Files API GET endpoints
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-20 16:11:09 +01:00
Sean McGivern d84cfeaf21 Merge branch '4269-public-repositories-api' into 'master'
Allow Repositories API GET endpoints to be requested anonymously

Closes #4269

See merge request !8148
2016-12-20 14:36:50 +00:00
Hiroyuki Sato 1a59766d0c Merge two methods. 2016-12-20 22:43:59 +09:00
Rémy Coutable a85220506e Merge branch '25678-remove-user-build' into 'master'
Remove unnecessary method `build_user` from model `User` 

Closes #25678

See merge request !8162
2016-12-20 13:09:10 +00:00
Lin Jen-Shin 0f0738e788 Merge remote-tracking branch 'upstream/master' into feature/1376-allow-write-access-deploy-keys
* upstream/master: (538 commits)
  Reject blank environment vcariables in Gitlab::Git::RevList
  Add online terminal documentation
  Add changelog entry
  Add terminal UI and controller actions
  Fix specs
  Even out padding on plus button in breadcrumb menu
  Update font size of detail page header to 14px
  Update CHANGELOG.md for 8.13.10
  Update CHANGELOG.md for 8.14.5
  Fix Route#rename_children behavior
  Remove inline-block styling from status
  Add terminals to the Kubernetes deployment service
  Add a ReactiveCaching concern for use in the KubernetesService
  Add xterm.js 2.1.0 and a wrapper class to the asset pipeline
  Remove unnecessary hidden svg elements for icons.
  Fix consistent typo in environment.js
  Use a block to insert extra check for authenticate_build!
  Align milestone column header with count number
  Add Wiki import to BB importer
  Make CI badge hitboxes better match container
  ...
2016-12-20 20:54:40 +08:00
Grzegorz Bizon 52278412c7 Merge branch 'zj-kamil-slack-slash-commands' into 'master'
Slack slash commands

## What does this MR do?

Implement Slack Slash Commands by utilizing generalized Mattermost presenter to fulfill Slack requirements.

## Why was this MR needed?

We want to expose Slack Slash Commands as a first-class service.

## What are the relevant issue numbers?

Supersedes !8007  
Closes #22182

See merge request !8126
2016-12-20 09:41:37 +00:00
Hiroyuki Sato 1f19275719 Rename sha to id 2016-12-20 18:24:24 +09:00
Hiroyuki Sato b1ca2c7dd8 Use Repository#cache_last_commit_sha_for_path in API 2016-12-20 18:24:24 +09:00
Rémy Coutable 2e6c1720ea Allow Repositories API GET endpoints to be requested anonymously
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-19 18:52:42 +01:00
Kamil Trzcinski 298d05a5c3
Improve after feedback 2016-12-19 15:40:06 +01:00
Douglas Barbosa Alexandre 022242c30f Merge branch '25301-git-2.11-force-push-bug' into 'master'
Accept environment variables from the `pre-receive` script

## Summary

1. Starting version 2.11, git changed the way the pre-receive flow works.
  - Previously, the new potential objects would be added to the main repo. If the pre-receive passes, the new objects stay in the repo but are linked up. If the pre-receive fails, the new objects stay orphaned in the repo, and are cleaned up during the next `git gc`.
  - In 2.11, the new potential objects are added to a temporary "alternate object directory", that git creates for this purpose. If the pre-receive passes, the objects from the alternate object directory are migrated to the main repo. If the pre-receive fails the alternate object directory is simply deleted.
2. In our workflow, the pre-recieve script (in `gitlab-shell`) calls the
   `/allowed` endpoint, which calls out directly to git to perform
   various checks. These direct calls to git do _not_ have the necessary
   environment variables set which allow access to the "alternate object
   directory" (explained above). Therefore these calls to git are not able to
   access any of the new potential objects to be added during this push.

3. We fix this by accepting the relevant environment variables
   (`GIT_ALTERNATE_OBJECT_DIRECTORIES`, `GIT_OBJECT_DIRECTORY`, and
   `GIT_QUARANTINE_PATH`) on the `/allowed` endpoint, and then include
   these environment variables while calling out to git.

4. This commit includes these environment variables while making the "force
   push" check.

## Issue Numbers

- Closes #25301 (assuming the corresponding `gitlab-shell` MR has been merged in first)
- Corresponding `gitlab-shell` MR: gitlab-org/gitlab-shell!112
- Corresponding EE MR: gitlab-org/gitlab-ee!964

## Tasks

-  [#25301/!7967/!112] Git version 2.11.0 - Can't push to protected branch as master or developer
    - [x]  Investigate
    - [x]  Implementation
        - [x]  `force_push.rb` should use the relevant environment variables
        - [x]  Any other instances of `/allowed` calling out to git directly? 
        - [x]  Verify that the fix works over SSH as well
        - [x]  Can we trim the number of env variables? Do we need all 3?
        - [x]  Whitelist variables. Server shouldn't pass through _any_ env variable passed in
        - [x]  Any security implications?
        - [x]  Check for force push return code
        - [x]  Shouldn't be able to opt-out from the force push check by passing an env variable
    - [x]  Tests
        - [x]  CE
            - [x]  Added
            - [x]  Passing
        - [x]  Shell
            - [x]  Added
            - [x]  Passing
    - [x]  Meta
        - [x]  CHANGELOG entry created
        - [x]  Branch has no merge conflicts with `master`
        - [x]  Squashed related commits together
        - [x]  EE merge request
    - [x]  Review
        - [x]  Endboss
    - [ ]  Follow-up
        - [x]  Make sure EE is working as expected
        - [x]  [CE] Gitlab changes without gitlab-shell changes shouldn't raise any exceptions
        - [x]  [CE] Gitlab-shell changes without gitlab changes shouldn't raise any exceptions
        - [x]  [EE] Gitlab changes without gitlab-shell changes shouldn't raise any exceptions
        - [x]  [EE] Gitlab-shell changes without gitlab changes shouldn't raise any exceptions
    - [ ]  Wait for merge
        - [ ]  CE
        - [ ]  EE
        - [x]  Shell


See merge request !7967
2016-12-19 09:37:16 +00:00
Arsenev Vladislav 3cc334eae5 remove build_user from model User 2016-12-18 23:26:29 +00:00
Kamil Trzcinski 14d47884df
Merge remote-tracking branch 'origin/master' into dockerfile-templates 2016-12-18 23:39:51 +01:00
Timothy Andrew f82d549d26 Accept environment variables from the `pre-receive` script.
1. Starting version 2.11, git changed the way the pre-receive flow works.

  - Previously, the new potential objects would be added to the main repo. If the
    pre-receive passes, the new objects stay in the repo but are linked up. If
    the pre-receive fails, the new objects stay orphaned in the repo, and are
    cleaned up during the next `git gc`.

  - In 2.11, the new potential objects are added to a temporary "alternate object
    directory", that git creates for this purpose. If the pre-receive passes, the
    objects from the alternate object directory are migrated to the main repo. If
    the pre-receive fails the alternate object directory is simply deleted.

2. In our workflow, the pre-recieve script (in `gitlab-shell) calls the
   `/allowed` endpoint, which calls out directly to git to perform
   various checks. These direct calls to git do _not_ have the necessary
   environment variables set which allow access to the "alternate object
   directory" (explained above). Therefore these calls to git are not able to
   access any of the new potential objects to be added during this push.

3. We fix this by accepting the relevant environment variables
   (GIT_ALTERNATE_OBJECT_DIRECTORIES, GIT_OBJECT_DIRECTORY) on the
   `/allowed` endpoint, and then include these environment variables while
   calling out to git.

4. This commit includes (whitelisted) these environment variables while making
   the "force push" check. A `Gitlab::Git::RevList` module is extracted to
   prevent `ForcePush` from being littered with these checks.
2016-12-16 23:32:25 +05:30
Rémy Coutable ca6bf62ec1 Merge branch '20492-access-token-scopes' into 'master'
Resolve "Add a doorkeeper scope suitable for authentication"

## What does this MR do?

- Add a single new scope (in addition to the `api` scope we've had) - `read_user`
- Allow creating OAuth applications and Personal access tokens with a scope selected
- Enforce scopes in the API

## What are the relevant issue numbers?

- Closes #20492 
- EE counterpart for this MR: gitlab-org/gitlab-ee!946

See merge request !5951
2016-12-16 17:38:41 +00:00
Kamil Trzciński bdb5e67718 Merge branch 'issue_22269' into 'master'
Mattermost Notifications Service

## What does this MR do?
closes #22269 

## Screenshots 

![mattermost](/uploads/de71c121f544a91305b6dfa6dc4c5738/mattermost.png)  
![slack](/uploads/081d75d49239319d94332abda214fb98/slack.png)

## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) 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 it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)


See merge request !7764
2016-12-16 13:23:19 +00:00
Timothy Andrew b303948ff5 Convert AccessTokenValidationService into a class.
- Previously, AccessTokenValidationService was a module, and all its  public
methods accepted a token. It makes sense to convert it to a class which accepts
a token during initialization.

- Also rename the `sufficient_scope?` method to `include_any_scope?`

- Based on feedback from @rymai
2016-12-16 16:29:32 +05:30
Timothy Andrew 4d6da770de Implement minor changes from @dbalexandre's review.
- Mainly whitespace changes.

- Require the migration adding the `scope` column to the
  `personal_access_tokens` table to have downtime, since API calls will
  fail if the new code is in place, but the migration hasn't run.

- Minor refactoring - load `@scopes` in a `before_action`, since we're
  doing it in three different places.
2016-12-16 16:29:31 +05:30
Timothy Andrew 7fa06ed55d Calls to the API are checked for scope.
- Move the `Oauth2::AccessTokenValidationService` class to
  `AccessTokenValidationService`, since it is now being used for
  personal access token validation as well.

- Each API endpoint declares the scopes it accepts (if any). Currently,
  the top level API module declares the `api` scope, and the `Users` API
  module declares the `read_user` scope (for GET requests).

- Move the `find_user_by_private_token` from the API `Helpers` module to
  the `APIGuard` module, to avoid littering `Helpers` with more
  auth-related methods to support `find_user_by_private_token`
2016-12-16 16:29:31 +05:30
Kamil Trzciński 8b26ff58e1 Update templates.rb 2016-12-16 09:17:15 +00:00