summaryrefslogtreecommitdiff
path: root/lib/api
Commit message (Collapse)AuthorAgeFilesLines
* Fix state_event parameter to reopen an issuefixes-issues-api-reopenRobert Schilling2016-12-221-2/+1
|
* Merge branch 'fix/25843' into 'master' Sean McGivern2016-12-201-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Rename MattermostNotificationService back to MattermostServicefix/25843Douglas Barbosa Alexandre2016-12-201-1/+1
| |
| * Rename SlackNotificationService back to SlackServiceDouglas Barbosa Alexandre2016-12-201-1/+1
| |
* | Allow unauthenticated access to Repositories Files API GET endpointsRémy Coutable2016-12-201-2/+0
| | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Merge branch '4269-public-repositories-api' into 'master' Sean McGivern2016-12-201-6/+0
|\ \ | |/ |/| | | | | | | | | Allow Repositories API GET endpoints to be requested anonymously Closes #4269 See merge request !8148
| * Allow Repositories API GET endpoints to be requested anonymouslyRémy Coutable2016-12-191-6/+0
| | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* | Merge branch '25678-remove-user-build' into 'master' Rémy Coutable2016-12-201-1/+1
|\ \ | | | | | | | | | | | | | | | | | | Remove unnecessary method `build_user` from model `User` Closes #25678 See merge request !8162
| * | remove build_user from model UserArsenev Vladislav2016-12-181-1/+1
| | |
* | | Merge branch 'zj-kamil-slack-slash-commands' into 'master' Grzegorz Bizon2016-12-201-1/+8
|\ \ \ | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | Improve after feedbackKamil Trzcinski2016-12-191-1/+8
| | |
* | | Merge branch '25301-git-2.11-force-push-bug' into 'master' Douglas Barbosa Alexandre2016-12-192-1/+13
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * | | Accept environment variables from the `pre-receive` script.Timothy Andrew2016-12-162-1/+13
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge remote-tracking branch 'origin/master' into dockerfile-templatesdockerfile-templatesKamil Trzcinski2016-12-1846-1831/+2566
|\ \ \ | |/ /
| * | Merge branch '20492-access-token-scopes' into 'master' Rémy Coutable2016-12-164-22/+50
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Convert AccessTokenValidationService into a class.Timothy Andrew2016-12-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
| | * Implement minor changes from @dbalexandre's review.Timothy Andrew2016-12-161-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
| | * Calls to the API are checked for scope.Timothy Andrew2016-12-164-30/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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`
| * | Merge branch 'issue_22269' into 'master' Kamil Trzciński2016-12-161-1/+9
| |\ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| | * Change SlackService to SlackNotificationsServiceissue_22269_fix_eeissue_22269Felipe Artur2016-12-151-1/+9
| | |
| * | Add an environment slugNick Thomas2016-12-153-1/+18
| |/
| * Introduce deployment services, starting with a KubernetesServiceNick Thomas2016-12-141-0/+28
| |
| * Merge branch 'api-cherry-pick' into 'master' Rémy Coutable2016-12-131-1/+35
| |\ | | | | | | | | | | | | | | | | | | Adds the ability to cherry pick a commit via the API. Right now it only supports to directly cherry pick a commit and not starting a MR from it. Shall we do that also for the API? Closes #25450 See merge request !8047
| | * API: Ability to cherry-pick a commitRobert Schilling2016-12-131-1/+35
| | |
| * | Merge branch '25482-fix-api-sudo' into 'master' Sean McGivern2016-12-132-54/+77
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | API: Memoize the current_user so that the sudo can work properly Closes #25482 See merge request !8017
| | * | Be smarter when finding a sudoed user in API::Helpers25482-fix-api-sudoRémy Coutable2016-12-131-13/+11
| | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| | * | API: Memoize the current_user so that the sudo can work properlyRémy Coutable2016-12-122-54/+79
| | |/ | | | | | | | | | | | | | | | | | | | | | The issue was arising when `#current_user` was called a second time after a user was impersonated: the `User#is_admin?` check would be performed on it and it would fail. Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | Merge branch 'api-simple-group-project' into 'master' Rémy Coutable2016-12-131-1/+4
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | API: Ability to get group's project in simple representation Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/25412 See merge request !8060
| | * | API: Ability to get group's project in simple representationapi-simple-group-projectRobert Schilling2016-12-131-1/+4
| | | |
| * | | Merge branch 'api-dont-allow-blank-mr-titles' into 'master' Sean McGivern2016-12-131-2/+2
| |\ \ \ | | |/ / | |/| | | | | | | | | | | | | | | | | | Don't allow blank MR titles in API Closes #25033 See merge request !7848
| | * | Don't allow blank MR titles in APIapi-dont-allow-blank-mr-titlesRobert Schilling2016-12-131-2/+2
| | |/
| * | Merge branch 'grapify-service-api' into 'master' Rémy Coutable2016-12-122-65/+572
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | Grapify the service API Related to #22928 See merge request !7970
| | * | Grapify the service APIRobert Schilling2016-12-092-65/+572
| | | |
| * | | Merge branch 'api-fix-group-projects-filter' into 'master' Rémy Coutable2016-12-121-1/+10
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API: Add the project filter to the groups endpoint. Related to #22928. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/25420 See merge request !8034
| | * | | API: Fix groups filterRobert Schilling2016-12-121-1/+10
| | | | |
| * | | | Merge branch 'issue_25030' into 'master' Sean McGivern2016-12-121-8/+8
| |\ \ \ \ | | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | Allow branch names with dots on API endpoint closes #25030 See merge request !7963
| | * | | Allow branch names with dots on API endpointissue_25030Felipe Artur2016-12-081-8/+8
| | | | |
| * | | | Merge branch 'features/api-snippets' into 'master' Sean McGivern2016-12-123-0/+151
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding support for personal snippet endpoint on the API Closes #22042 See merge request !6373
| | * | | | API: Endpoint to expose personal snippets as /snippetsGuyzmo2016-12-013-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adding the necessary API for the new /snippets Restful resource added with this commit. Added a new Grape class `Snippets`, as well as a `PersonalSnippet` entity. Issue: #20042 Merge-Request: !6373 Signed-off-by: Guyzmo <guyzmo+gitlab+pub@m0g.net>
| * | | | | Merge branch 'api-remove-source-branch' into 'master' Rémy Coutable2016-12-091-2/+6
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | API: Ability to remove source branch Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/23577 See merge request !7804
| | * | | | | API: Ability to remove source branchapi-remove-source-branchRobert Schilling2016-12-041-2/+6
| | | | | | |
| * | | | | | Merge branch 'dz-nested-groups' into 'master' Douwe Maan2016-12-091-1/+1
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add nested groups support on data level ## What does this MR do? - [x] Add `parent_id` field to `Namespace`model. - [x] Create new database table `routes` that keeps information about full path to each group or project - [x] Remove uniq index from `namespaces.path` - [x] Add uniq index on `routes.path` - [x] Fill routes table with path data from namespaces and projects - [x] Change Namespace/Project URL lookup by routes table - [x] Rename related routes (nested groups, projects) when parent path changes This is solely backend preparation. UI, Permissions and API support will be added in separate merge request. ## Are there points in the code the reviewer needs to double check? migrations, Route model, Routable concern Will require downtime. See https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7121#note_19490281 discussion ## Why was this MR needed? One step further to full nested groups support ## Screenshots (if relevant) No UI changes in this merge request so far ## Does this MR meet the acceptance criteria? - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG.md) entry added~~ - ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - ~~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) ## What are the relevant issue numbers? https://gitlab.com/gitlab-org/gitlab-ce/issues/2772 See merge request !7121
| | * | | | | | Add nested groups support on data leveldz-nested-groupsDmitriy Zaporozhets2016-12-081-1/+1
| | | |_|_|/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add parent_id field to namespaces table to store relation with nested groups * create routes table to keep information about full path of every group and project * project/group lookup by full path from routes table Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * | | | | | Merge branch 'public-tags-api' into 'master' 19703-direct-link-pipelines-into-buildsDouwe Maan2016-12-081-1/+0
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow public access to some Tag API endpoints Continuation of #4269. See merge request !7896
| | * | | | | | Allow public access to some Tag API endpointspublic-tags-apiRémy Coutable2016-12-071-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
| * | | | | | | Merge branch '24537-reenable-private-token-with-sudo' into 'master' Douwe Maan2016-12-084-16/+23
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reenables /user API request to return private-token if user is admin and requested with sudo ## What does this MR do? Reenables the API /users to return `private-token` when sudo is either a parameter or passed as a header and the user is admin. ## Screenshots (if relevant) Without **sudo**: ![Screen_Shot_2016-11-21_at_11.44.49](/uploads/ebecf95dbadaf4a159b80c61c75771d9/Screen_Shot_2016-11-21_at_11.44.49.png) With **sudo**: ![Screen_Shot_2016-11-21_at_11.45.52](/uploads/f25f9ddffcf2b921e9694e5a250191d3/Screen_Shot_2016-11-21_at_11.45.52.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) ## What are the relevant issue numbers? Closes #24537 See merge request !7615
| | * | | | | | | adds impersonator variable and makes sudo usage overall more clear24537-reenable-private-token-with-sudotiagonbotelho2016-12-074-17/+23
| | | | | | | | |
| | * | | | | | | Reenables /user API request to return private-token if user is admin and ↵tiagonbotelho2016-12-072-1/+2
| | | |/ / / / / | | |/| | | | | | | | | | | | | | | | | | | | | requested with sudo
| * | | | | | | Grapify the issues APIgrapify-issues-apiRobert Schilling2016-12-072-167/+112
| |/ / / / / /
| * | | | | | A simpler implementation of finding a merge requestBob Van Landuyt2016-12-061-9/+6
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | Following a discussion in !7180