Commit Graph

418 Commits

Author SHA1 Message Date
GitLab Bot 31a340adab Add latest changes from gitlab-org/gitlab@master 2020-05-15 18:07:52 +00:00
GitLab Bot c7ba7b9976 Add latest changes from gitlab-org/gitlab@master 2020-05-11 09:09:45 +00:00
GitLab Bot c6acc1681a Add latest changes from gitlab-org/gitlab@master 2020-04-23 12:09:46 +00:00
GitLab Bot 684d65316a Add latest changes from gitlab-org/gitlab@master 2020-04-02 12:08:18 +00:00
GitLab Bot b11f7057d0 Add latest changes from gitlab-org/gitlab@master 2020-04-01 09:07:45 +00:00
GitLab Bot 2c72daf2f1 Add latest changes from gitlab-org/gitlab@master 2020-03-30 18:08:07 +00:00
GitLab Bot dc003cd08b Add latest changes from gitlab-org/gitlab@master 2020-03-26 18:08:03 +00:00
GitLab Bot 8f9beefac3 Add latest changes from gitlab-org/gitlab@master 2020-03-23 12:09:47 +00:00
GitLab Bot ac1dca43ba Add latest changes from gitlab-org/gitlab@master 2020-03-09 12:07:45 +00:00
GitLab Bot df2eda3f14 Add latest changes from gitlab-org/gitlab@master 2020-02-20 18:08:51 +00:00
GitLab Bot c8f773a859 Add latest changes from gitlab-org/gitlab@master 2020-01-30 21:08:47 +00:00
GitLab Bot 6b9d3a4e83 Add latest changes from gitlab-org/gitlab@master 2020-01-29 18:08:47 +00:00
GitLab Bot 3832718d89 Add latest changes from gitlab-org/gitlab@master 2020-01-22 18:08:47 +00:00
GitLab Bot aa0f0e9921 Add latest changes from gitlab-org/gitlab@master 2020-01-16 18:08:46 +00:00
GitLab Bot 8b1228b0d4 Add latest changes from gitlab-org/gitlab@master 2020-01-10 15:07:47 +00:00
GitLab Bot f864f8a7aa Add latest changes from gitlab-org/gitlab@master 2019-12-20 12:07:40 +00:00
GitLab Bot 5bd24a54ef Add latest changes from gitlab-org/gitlab@master 2019-12-17 09:07:48 +00:00
GitLab Bot d10a462fed Add latest changes from gitlab-org/gitlab@master 2019-12-16 12:07:43 +00:00
GitLab Bot 8cc5f27909 Add latest changes from gitlab-org/gitlab@master 2019-12-13 12:07:41 +00:00
GitLab Bot 3fe3436877 Add latest changes from gitlab-org/gitlab@master 2019-11-15 06:06:13 +00:00
GitLab Bot 7801d133b6 Add latest changes from gitlab-org/gitlab@master 2019-11-12 09:06:14 +00:00
GitLab Bot 7071f9bf3e Add latest changes from gitlab-org/gitlab@master 2019-11-11 15:06:42 +00:00
GitLab Bot 9865665cb1 Add latest changes from gitlab-org/gitlab@master 2019-10-08 12:06:01 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Dinesh Panda 736b5908da Avoid calling freeze on already frozen strings in lib 2019-09-10 08:11:43 +00:00
Victor Zagorodny e4fbd94cf5 Update CE files for GSD projects filter
A new param with_security_reports was added to
GET /groups/:id/projects API and the code to
support this logic in GroupProjectsFinder and
Project model. Also, a DB index was added to
ci_job_artifacts table to speed up the search
of security reports artifacts for projects
2019-08-28 14:26:42 +00:00
manojmj 6cfd13726f CE: Add project download & project export audit event
This change adds audit events for
download of repository and export of
project.
2019-07-26 12:25:56 +05:30
Sam Battalio 3457695b1e Change HTTP Status Code when repository disabled 2019-06-24 22:12:42 +00:00
Robert Speicher ea1b24cbe0 Merge branch 'pderichs-52123' into 'master'
Use NotesFinder to get Noteable

See merge request gitlab-org/gitlab-ce!28205
2019-06-19 15:58:43 +00:00
Patrick Derichs 932a9a0c77 Use NotesFinder to fetch notes on API and Controllers
Fix missing iid query on NotesFinder

Changed parameters of find_noteable, 
so changes across a few files were needed.
MergeRequest also requires iid instead of id query

Make NotesFinder fail with RecordNotFound again

Add specs for target_iid

Using RSpec tablesyntax for target_iid specs

Revert "Using RSpec tablesyntax for target_iid specs"

This reverts commit ba45c7f569a.

Allow find_by! here

Fix variable name

Add readable check

Revert "Add readable check"

This reverts commit 9e3a1a7aa39.

Remove unnecessary assignment

Add required changes for EE

Fix parameter count

Reduce code duplication by extracting a noteable module method

The call to find_noteable was redundant so
multiple files and lines have changed in that
commit to use the newly introduced module
method `noteable`.

Replace casecmp with include check

Add parent_type parameter


Revert "Reduce code duplication by extracting
a noteable module method"

This reverts commit 8c0923babf.

Method is no longer needed

Check whether noteable can be read by user
2019-06-19 10:56:55 +02:00
Manoj MJ 53b17f0301 Add documentation and tests
This commit adds
 - feature specs
  - to test the ability of a user with "developer" permission
    to delete tags in repositories.
 - documentation
2019-06-19 07:08:56 +00:00
Shinya Maeda 387a4f4b2c Remove legacy artifact related code
We've already migrated all the legacy artifacts to the new realm,
which is ci_job_artifacts table.
It's time to remove the old code base that is no longer used.
2019-05-31 10:49:17 +07:00
Rémy Coutable c563e29fb3
Get rid of the user_namespace API helper method
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-04-24 19:39:59 +02:00
Fabio Busatto 035c8af12e Resolve "Get milestone by title via API" 2019-03-27 09:01:07 +00:00
Bob Van Landuyt b0fac091ec Authenticate the internal API using a header
Instead of mixing in the shared secret into the querystring or body,
we could also specify it in a header.
2019-03-11 16:46:04 +01:00
Roger Rüttimann 4db8336786 API: delete job_artifacts of a single job 2019-03-06 11:06:21 +00:00
Nermin Vehabovic eccfab4445 Added: Specs for sort page breaks on notes 2019-02-16 16:11:31 +01:00
Nermin Vehabovic f43cb6e79d Fixed: Warnings from static code analysis 2019-02-16 11:52:21 +01:00
Nermin Vehabovic ff671366cb Added: Include order by ID desc for tie breakers in pagination 2019-02-16 11:03:42 +01:00
Sean McGivern d91b96458e Merge branch 'api-group-labels' into 'master'
API group labels

Closes #44901

See merge request gitlab-org/gitlab-ce!21368
2019-02-07 09:48:04 +00:00
Stan Hu 41b51c0656 Encode Content-Disposition filenames
Users downloading non-ASCII attachments would see garbled characters.
When used with object storage, AWS S3 would return an InvalidArgument
error: Header value cannot be represented using ISO-8859-1.

Per RFC 5987 and RFC 6266, Content-Disposition should be encoded
properly. This commit takes the Rails 6 implementation of
ActiveSuppport::Http::ContentDisposition
(https://github.com/rails/rails/pull/33829) and ports it here.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/47673
2019-02-04 23:12:44 -08:00
Robert Schilling 0ce33f6b4f Factor out common label API 2019-01-31 13:49:52 +01:00
Robert Schilling a9fdc3118a Incorporate feedback from Robert 2019-01-31 13:49:51 +01:00
Robert Schilling 4e9aa7e2c0 Correctly search for labels in parent groups 2019-01-31 13:49:51 +01:00
Robert Schilling ee826ad4a1 Replace finders 2019-01-31 13:49:50 +01:00
Robert Schilling eed79986c9 Add subscription API for the group label API 2019-01-31 13:49:49 +01:00
Mayra Cabrera 8b2fe985dd Restrict multiple clusters through API
Modifies authorize! method to accept a third param, and then use it in
combination with 'add_cluster' policy to appropriately restrict adding
multiple clusters

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56110
2019-01-10 18:20:04 -06:00
Francisco Javier López 40887a94bd Fix files/blob api endpoint content disposition 2019-01-10 12:30:19 +00:00
Stan Hu aff2b6e4eb Switch use of Rack::Request to ActionDispatch::Request
As mentioned in
https://gitlab.com/gitlab-org/gitlab-ee/issues/9035#note_129093444,
Rails 5 switched ActionDispatch::Request so that it no longer inherits
Rack::Request directly. A middleware that uses Rack::Request to
read the environment may see stale request parameters if
another middleware modifies the environment via ActionDispatch::Request.
To be safe, we should be using ActionDispatch::Request everywhere.
2019-01-07 00:35:53 -08:00
Francisco Javier López 2cd47bba9a
Fixed api content-disposition in blob and files endpoint 2018-12-31 13:02:32 +01:00
Stan Hu f5847911ca Bump Gitaly version to v1.12.0 2018-12-21 23:41:37 +00:00
Jasper Maes 56296f1eda Remove rails4 specific code 2018-12-16 10:48:41 +01:00
Kamil Trzciński 39c1731a53 Log and pass correlation-id between Unicorn, Sidekiq and Gitaly
The Correlation ID is taken or generated from received X-Request-ID.
Then it is being passed to all executed services (sidekiq workers
or gitaly calls).

The Correlation ID is logged in all structured logs as `correlation_id`.
2018-12-06 20:46:14 +01:00
Francisco Javier López 9a5703ec82 Set content disposition attachment to several endpoints 2018-11-23 16:44:09 +00:00
William George 1b153d497b Make getting a user by the username case insensitive 2018-10-18 09:06:44 +00:00
gfyoung 3836d69119 Enable frozen string in lib/api and lib/backup
Partially addresses #47424.

Had to make changes to spec files because
stubbing methods on frozen objects is a mess
in RSpec and leads to failures:

https://github.com/rspec/rspec-mocks/issues/1190
2018-09-29 21:04:50 -07:00
Robert Speicher c7d1eef671 Merge branch 'rubocop-code-reuse' into 'master'
Add RuboCop cops to enforce code reusing rules

See merge request gitlab-org/gitlab-ce!21391
2018-09-13 14:53:05 +00:00
🙈 jacopo beschi 🙉 8e52f56d8d Resolve "500 Internal Server Error: Deleting branch of deleted project" 2018-09-12 20:52:30 +00:00
Yorick Peterse 2039c8280d
Disable existing offenses for the CodeReuse cops
This whitelists all existing offenses for the various CodeReuse cops, of
which most are triggered by the CodeReuse/ActiveRecord cop.
2018-09-11 17:32:00 +02:00
Robert Schilling 4e39fc1a40 Fix rubocop 2018-09-08 11:44:55 +02:00
Robert Schilling a14e9cfde8 API: Use find_branch! in all places 2018-09-08 10:55:17 +02:00
Marko, Peter 6d72bb3832 Add min_access_level filter to projects API
Signed-off-by: Marko, Peter <peter.marko@siemens.com>
2018-07-23 20:57:50 +02:00
Marko, Peter 209fd86442 Fix archived parameter for projects API 2018-07-16 16:25:38 +02:00
Jasper Maes 876d43b9f5 Rails5 fix no implicit conversion of Hash into String. ActionController::Parameters no longer returns an hash in Rails 5 2018-06-13 23:49:44 +02:00
Jan Provaznik 7a76caa5a8 Merge request and commit discussions API 2018-05-01 12:39:44 +00:00
Andreas Brandl c4e4258721 Validate project path prior to hitting the database.
Closes #45247.
2018-04-13 15:59:45 +02:00
Douwe Maan 44f4a674e2 Merge branch 'jramsay-38830-tarball' into 'master'
Add alternative archive route

Closes #38830

See merge request gitlab-org/gitlab-ce!17225
2018-04-06 14:14:39 +00:00
Grzegorz Bizon dd271e2460 Merge branch 'direct-upload-of-artifacts' into 'master'
Direct upload of artifacts

See merge request gitlab-org/gitlab-ce!18160
2018-04-05 20:59:40 +00:00
Kamil Trzciński 678620cce6 Add `direct_upload` setting for artifacts 2018-04-05 15:01:14 +02:00
James Ramsay 0b1b9c409d Add option to suppress archive commit sha
Repository archives are always named `<project>-<ref>-<sha>` even if
the ref is a commit. A consequence of always including the sha even
for tags is that packaging a release is more difficult because both
the ref and sha must be known by the packager.

- add append_sha option (defaults true) to provide a method for
toggling this feature.

Support added to GitLab Workhorse by gitlab-org/gitlab-workhorse!232
2018-04-04 16:56:18 -04:00
Felipe Artur ad7148d9ea Allow assigning and filtering issuables by ancestor group labels 2018-04-04 15:40:29 +00:00
Micaël Bergeron fc6587f1f2 Add proxy_download to perform proxied sending of all files 2018-03-09 09:16:06 -05:00
Kamil Trzciński a2f375e8f7 Merge remote-tracking branch 'origin/master' into object-storage-ee-to-ce-backport 2018-02-28 21:28:43 +01:00
Kamil Trzciński 729391fbfc Merge commit '8af23def1d6' into object-storage-ee-to-ce-backport 2018-02-28 21:11:53 +01:00
Grzegorz Bizon b14c484bb1 Merge branch 'use-send-url-for-incompatible-runners' into 'master'
Support SendURL for performing indirect download of artifacts if clients does…

See merge request gitlab-org/gitlab-ee!4401
2018-02-28 20:58:56 +01:00
Kamil Trzciński 45d2c31643 Merge commit '4b92efd90cedaa0aff218d11fdce279701128bea' into object-storage-ee-to-ce-backport 2018-02-28 20:46:53 +01:00
Kamil Trzciński 965dc28691 Merge commit '7fabc892f251740dbd9a4755baede662e6854870' into object-storage-ee-to-ce-backport 2018-02-28 20:36:55 +01:00
Kamil Trzciński e3fafa7632 Merge commit 'f2f58a60b76acd479e37bdbc9246ec9f9b2bea82' into object-storage-ee-to-ce-backport 2018-02-28 20:36:07 +01:00
Kamil Trzciński e0401df121 Merge commit '11c67e7c2f992299ff5918ce67995b73d1e0be6d' into object-storage-ee-to-ce-backport 2018-02-28 20:35:22 +01:00
Kamil Trzciński 5a69b51bc8 Merge commit 'b39d0c318921bae2e3a11df9ee6828291dad9864' into object-storage-ee-to-ce-backport 2018-02-28 20:06:12 +01:00
Kamil Trzciński b1f8d8a173 Merge commit '5b08d59f07fc53c1e34819fac20352119d5343e6' into object-storage-ee-to-ce-backport 2018-02-28 20:03:02 +01:00
Grzegorz Bizon 52c3b8f312 Merge branch 'zj-object-store-artifacts' into 'master'
Object store for artifacts

Closes gitlab-ce#29203

See merge request !1762
2018-02-28 20:00:27 +01:00
Bob Van Landuyt 148816cd67 Port `read_cross_project` ability from EE 2018-02-22 17:11:36 +01:00
🙈 jacopo beschi 🙉 729f05f0e3 Adds Rubocop rule for line break around conditionals 2018-01-11 16:34:01 +00:00
Stan Hu eaf9088ba8 Save user ID and username in Grape API log (api_json.log)
This will enable admins to identify who actually made the API request.

Relates to #36960
2018-01-08 21:23:24 -08:00
Sean McGivern 0f33ac6442 Merge branch 'backport-issue_3413' into 'master'
[EE-backport] Add group boards API endpoint

See merge request gitlab-org/gitlab-ce!16194
2018-01-05 14:17:19 +00:00
Felipe Artur 5e148d4e93 EE-BACKPORT group boards 2018-01-04 17:28:10 -02:00
Rubén Dávila cf8f09636b Fix API endpoints to edit wiki pages where project belongs to a group
In some cases is prefered to manually create a ProjectWiki over using
Project#wiki. This is because Project#wiki always uses the #owner (which
is a User sometimes) as the
author of the wiki changes but sometimes the owner is a Group and it
doesn't respond to #username
2018-01-03 00:22:01 -05:00
Lin Jen-Shin 85be6d83be Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (170 commits)
  support ordering of project notes in notes api
  Redirect to an already forked project if it exists
  Reschedule the migration to populate fork networks
  Create fork networks for forks for which the source was deleted.
  Fix item name and namespace text overflow in Projects dropdown
  Minor backport from EE
  fix link that was linking to `html` instead of `md`
  Backport epic tasklist
  Add timeouts for Gitaly calls
  SSHUploadPack over Gitaly is now OptOut
  fix icon colors in commit list
  Fix star icon color/stroke
  Backport border inline edit
  Add checkboxes to automatically run AutoDevops pipeline
  BE for automatic pipeline when enabling Auto DevOps
  I am certainly weary of debugging sidekiq but I don't think that's what was meant
  Ensure MRs always use branch refs for comparison
  Fix issue comment submit button disabled on GFM paste
  Lock seed-fu at the correct version in Gemfile.lock
  Improve indexes on merge_request_diffs
  ...
2017-11-30 15:20:00 +08:00
Tomasz Maczukin 97f966c445
Introduce :read_namespace access policy for namespace and group 2017-11-23 17:44:05 +01:00
Tomasz Maczukin dfbfd3c7d7
Allow request namespace by ID or path 2017-11-23 17:44:05 +01:00
Lin Jen-Shin 663593e87e Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (126 commits)
  Update VERSION to 10.3.0-pre
  Update CHANGELOG.md for 10.2.0
  default fill color for SVGs
  ignore hashed repos (for now) when using `rake gitlab:cleanup:repos`
  Use Redis cache for branch existence checks
  Update CONTRIBUTING.md: Link definition of done to criteria
  Use `make install` for Gitaly setups in non-test environments
  FileUploader should check for hashed_storage?(:attachments) to use disk_path
  Set the default gitlab-shell timeout to 3 hours
  Update composite pipelines index to include "id"
  Use arrays in Pipeline#latest_builds_with_artifacts
  Fix blank states using old css
  Skip confirmation user api
  Custom issue tracker
  Revert "check for `read_only?` first before seeing if request is disallowed"
  add `#with_metadata` scope to remove a N+1 from the notes' API
  Fix promoting milestone updating all issuables without milestone
  Batchload blobs for diff generation
  check for `read_only?` first before seeing if request is disallowed
  use `Gitlab::Routing.url_helpers` instead of `Rails.application.routes.url_helpers`
  ...
2017-11-22 17:07:01 +08:00
Lin Jen-Shin 07d3d44775 Move ModuleWithInstanceVariables to Gitlab namespace
And use .rubocop.yml to exclude paths we don't care,
rather than using the cop itself to exclude.
2017-11-22 17:06:57 +08:00
Lin Jen-Shin 9ac0c76b78 Use StrongMemoize and enable/disable cops properly 2017-11-18 01:01:53 +08:00
Lin Jen-Shin 0af35d7e30 Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (507 commits)
  Add dropdowns documentation
  Convert migration to populate latest merge request ID into a background migration
  Set 0.69.0 instead of latest for codeclimate image
  De-duplicate background migration matchers defined in spec/support/migrations_helpers.rb
  Update database_debugging.md
  Update database_debugging.md
  Move installation of apps higher
  Change to Google Kubernetes Cluster and add internal links
  Add Ingress description from official docs
  Add info on creating your own k8s cluster from the cluster page
  Add info about the installed apps in the Cluster docs
  Resolve "lock/confidential issuable sidebar custom svg icons iteration"
  Update HA README.md to clarify GitLab support does not troubleshoot DRBD.
  Update license_finder to 3.1.1
  Make sure NotesActions#noteable returns a Noteable in the update action
  Cache the number of user SSH keys
  Adjust openid_connect_spec to use `raise_error`
  Resolve "Clicking on GPG verification badge jumps to top of the page"
  Add changelog for container repository path update
  Update container repository path reference
  ...
2017-11-17 19:19:06 +08:00
Francisco Lopez 1436598e49 Moved Exceptions to Gitlab::Auth 2017-11-17 10:02:11 +01:00
Francisco Lopez aa84ef1e1a Moving exceptions to UserAuthFinders 2017-11-17 10:02:11 +01:00
Travis Miller 1162d89ac4 Add administrative endpoint to list all pages domains 2017-11-13 16:05:44 +00:00
Lin Jen-Shin fc6aad0b44 Merge remote-tracking branch 'upstream/master' into no-ivar-in-modules
* upstream/master: (1723 commits)
  Resolve "Editor icons"
  Refactor issuable destroy action
  Ignore routes matching legacy_*_redirect in route specs
  Gitlab::Git::RevList and LfsChanges use lazy popen
  Gitlab::Git::Popen can lazily hand output to a block
  Merge branch 'master-i18n' into 'master'
  Remove unique validation from external_url in Environment
  Expose `duration` in Job API entity
  Add TimeCop freeze for DST and Regular time
  Harcode project visibility
  update a changelog
  Put a condition to old migration that adds fast_forward column to MRs
  Expose project visibility as CI variable
  fix flaky tests by removing unneeded clicks and focus actions
  fix flaky test in gfm_autocomplete_spec.rb
  Use Gitlab::Git operations for repository mirroring
  Encapsulate git operations for mirroring in Gitlab::Git
  Create a Wiki Repository's raw_repository properly
  Add `Gitlab::Git::Repository#fetch` command
  Fix Gitlab::Metrics::System#real_time and #monotonic_time doc
  ...
2017-11-06 21:44:57 +08:00
Markus Koller 6902848a9c
Support custom attributes on projects 2017-11-06 10:51:46 +01:00
Douwe Maan b7c8f7d76d Update specs for sudo behavior 2017-11-02 11:39:03 +01:00
Douwe Maan 3f24f9ed18 Add sudo API scope 2017-11-02 11:39:03 +01:00
Travis Miller 8d1ab256bf Add pages domains API implementation 2017-10-22 08:04:43 -05:00
Douwe Maan 025c6eeaa1 Move all API authentication code to APIGuard 2017-10-12 11:13:37 +02:00
Alejandro Rodríguez 60a35e4230 Send API parameters as extra data for sentry errors 2017-10-05 18:31:34 -03:00
Rémy Coutable 3040b994df
Ensure no exception is raised when Raven tries to get the current user in API context
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-09-29 18:57:22 +02:00
Douwe Maan b6c5a73c0b Make sure API responds with 401 when invalid authentication info is provided 2017-09-28 14:17:52 +02:00
Lin Jen-Shin 6a4ee9aa71 Allow simple ivar ||= form. Update accordingly 2017-09-19 01:29:32 +08:00
Lin Jen-Shin 9ae92b8caa Add cop to make sure we don't use ivar in a module 2017-09-18 21:23:45 +08:00
Ruben Davila 62bb6235c2 Make Members with Owner and Master roles always able to create subgroups 2017-09-07 13:47:58 -05:00
Grzegorz Bizon 8ed0a05107 Merge branch 'wiki_api' into 'master'
Add API support for wiki pages

Closes #12747

See merge request !13372
2017-09-07 10:38:03 +00:00
blackst0ne 2915bb2707 Add API support for wiki pages 2017-09-07 09:21:52 +11:00
Grzegorz Bizon c922fb4b68 Respond with a bad request if artifact path is invalid 2017-09-06 11:31:08 +02:00
Grzegorz Bizon 80b3dcc777 Extract job artifacts API code to a separate file 2017-09-06 11:20:12 +02:00
Grzegorz Bizon dfb8fcbb65 Use API helper to send artifact file through Workhorse 2017-09-05 11:16:49 +02:00
Sean McGivern b9d8946395 Don't use public_send in destroy_conditionally! helper
As we only override in two places, we could just ask for the value rather than
the method name.
2017-08-30 14:32:02 +01:00
Robert Schilling dcd4ea473c Update remaining endpoints 2017-08-28 17:10:30 +02:00
Robert Schilling e80313f9ee Conditionally destroy a ressource 2017-08-28 16:40:25 +02:00
Robert Schilling 998afa5f74 API: Respect the 'If-Unmodified-Since' for delete endpoints 2017-08-28 16:40:25 +02:00
Zeger-Jan van de Weg dc8e1676cd
Upgrade grape to 1.0
Main feature was the deprication of the Hashie stuff, so the access by
calling keys as method is gone now.
2017-08-16 22:06:31 +02:00
Lin Jen-Shin 4f0fa13eb8 Show error message for API 500 error in tests, and
document have_gitlab_http_status
2017-08-11 20:50:35 +08:00
Douwe Maan 14644d40e0 Do not validate CSRF token in API unless needed 2017-08-02 18:20:31 +02:00
Douwe Maan dcf4a2e83c Rescue only from ActionController::InvalidAuthenticityToken 2017-07-26 11:25:10 +02:00
blackst0ne cc3a82bc8b Add `rescue false`. 2017-07-26 11:05:44 +02:00
blackst0ne 8ce8b21f67 Refactor CSRF protection 2017-07-26 11:05:44 +02:00
blackst0ne 2902235099 Add CSRF token verification to API 2017-07-26 11:05:44 +02:00
Felipe Artur c5c9dce270 Add group milestones API endpoint 2017-07-21 11:00:00 -03:00
vanadium23 8d44d5142a Add user projects API 2017-07-06 08:04:54 +03:00
Timothy Andrew 4dbfa14e16 Implement review comments from @dbalexandre for !12300. 2017-06-28 07:17:13 +00:00
Timothy Andrew d774825f98 When verifying scopes, manually include scopes from `API::API`.
- They are not included automatically since `API::Users` does not inherit from
  `API::API`, as I initially assumed.

- Scopes declared in `API::API` are considered global (to the API), and need to
  be included in all cases.
2017-06-28 07:17:13 +00:00
Timothy Andrew 80c1ebaa83 Allow API scope declarations to be applied conditionally.
- Scope declarations of the form:

    allow_access_with_scope :read_user, if: -> (request) { request.get? }

  will only apply for `GET` requests

- Add a negative test to a `POST` endpoint in the `users` API to test this. Also
  test for this case in the `AccessTokenValidationService` unit tests.
2017-06-28 07:17:13 +00:00
Timothy Andrew 6f1922500b Initial attempt at refactoring API scope declarations.
- Declaring an endpoint's scopes in a `before` block has proved to be
  unreliable. For example, if we're accessing the `API::Users` endpoint - code
  in a `before` block in `API::API` wouldn't be able to see the scopes set in
  `API::Users` since the `API::API` `before` block runs first.

- This commit moves these declarations to the class level, since they don't need
  to change once set.
2017-06-28 07:17:13 +00:00
Rémy Coutable 4cfa5ce4a9
Enable the Style/PreferredHashMethods cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-06-02 19:11:26 +02:00
Kamil Trzcinski 6185d12c18 Add missing specs 2017-06-01 16:34:48 +02:00
Toon Claes db679788e4 Add :owned param to ProjectFinder
And use it in the API.
2017-05-30 22:45:59 +02:00
Toon Claes 0f0b9a8466 Use helper to construct Finder params
The ProjectsFinder and GroupFinder both support the same set of params. And the
`/api/v4/projects` and `/api/v4/group/:id/projects` also support the same set of
params. But they do not match the Finder params. So use a helper method to
transform them.
2017-05-30 22:45:59 +02:00
Toon Claes a1deed629e Use ProjectFinder to filter the projects
Instead of trying to do the heavy lifting in the API itself, use the existing
features of the ProjectFinder.
2017-05-30 22:45:59 +02:00
Toon Claes 07fc79e7c5 Handle `membership` in ProjectFinder
The ProjectFinder supports the `non_public` parameter. This can be used to find
only projects the user is member of.
2017-05-30 22:45:59 +02:00
Robert Speicher cb2f739d48 Merge branch '27144-enforce-rubocop-trailing_commas-no_comma-style' into 'master'
Resolve "Use consistent style for trailing commas"

Closes #27144

See merge request !11063
2017-05-10 21:43:34 +00:00
Rémy Coutable 3db37e0562 Enable the Style/TrailingCommaInArguments cop
Use the EnforcedStyleForMultiline: no_comma option.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-05-10 18:25:45 +02:00
Bob Van Landuyt ebd8b7f60f Use new SnippetsFinder signature in API 2017-05-10 16:48:18 +02:00
Timothy Andrew 4dfdef2ddf Allow admins to sudo to blocked users.
- Currently, (for example) admins can't delete snippets for blocked users, which
  is an unexpected limitation.

- We modify `authenticate!` to conduct the `access_api` policy check against the
  `initial_current_user`, instead of the user being impersonated.

- Update CHANGELOG for !10842
2017-04-26 08:00:19 +00:00
blackst0ne 11aff97d88 Remove the User#is_admin? method 2017-04-09 13:20:57 +11:00
Toon Claes add5cd996f API: Make the /notes endpoint work with noteable iid instead of id
In API V4 all endpoints were changed so Merge Requests and Issues
should be referred by iid, instead of id. Except the /notes endpoint
was forgotten. So change the endpoints from:

- /projects/:id/issues/:issue_id/notes
- /projects/:id/merge_requests/:merge_request_id/notes

To:

- /projects/:id/issues/:issue_iid/notes
- /projects/:id/merge_requests/:merge_request_iid/notes

For Project Snippets nothing changes.
2017-03-27 15:29:37 +02:00
http://jneen.net/ 0ea04cc5bf use the policy stack to protect logins 2017-03-09 11:49:52 -08:00
http://jneen.net/ 846e581732 use a magic default :global symbol instead of nil
to make sure we mean the global permissions
2017-03-09 11:49:52 -08:00
Timothy Andrew 719327112c
API routes referencing a specific merge request should use the MR `iid`
- As opposed to the `id` that was previously being used.
- This brings the API routes closer to the web interface's routes.
- This is specific to API v4.
2017-03-07 13:06:42 +05:30
Timothy Andrew dd99622347
API routes referencing a specific issue should use the issue `iid`
- As opposed to the issue `id` that was previously being used.
- This brings the API routes closer to the web interface's routes.
- This is specific to API v4.
2017-03-07 13:06:42 +05:30
Pawel Chojnacki 8993801f0c Test various login scenarios if the limit gets enforced 2017-03-06 15:41:25 +01:00
Adam Niedzielski c727d4328f Remove "subscribed" field from API responses returning list of issues or merge requests 2017-03-06 14:17:07 +01:00