Commit Graph

230 Commits

Author SHA1 Message Date
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
Toon Claes 4fda13b68e Build options hash after finding the list of projects
Because this order makes more sense and makes the code easier to read.
2017-05-30 22:45:58 +02:00
Toon Claes 44fdf0a1e3 Move ProjectsFinder to `present_projects` for simplification
To avoid passing parameters double, move all filtering to the `present_projects`
helper.
2017-05-30 22:41:29 +02:00
blackst0ne a7349560b2 'New issue'/'New merge request' dropdowns should show only projects with issues/merge requests feature enabled 2017-05-30 15:35:49 +11: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
Rémy Coutable d40e1f547e Enable the Style/TrailingCommaInLiteral cop
Use the EnforcedStyleForMultiline: no_comma option.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-05-10 18:25:45 +02:00
Sean McGivern ba608dc0f2 Merge branch '12910-uploader-pers-snippet' into 'master'
Prepare uploaders for personal snippets comments

See merge request !11022
2017-05-04 10:47:10 +00:00
Mark Fletcher 21f5515a5f Expose project statistics on single requests via the API
+ The statistics parameter was already accepted
* This commit ensure that it is respected for GET /projects/:id endpoint
+ Add documentation of the parameter and update the example response for stats
2017-05-03 18:45:19 +08:00
Jarka Kadlecova 43ff738641 Support uploaders for personal snippets comments 2017-05-02 15:22:24 +02:00
winniehell de2c2d9cc6 Replace builds_enabled with jobs_enabled in projects API v4 (!10786) 2017-04-20 00:29:09 +02:00
Oswaldo Ferreira fd32960e7c Separate CE params on Grape API 2017-04-10 16:13:48 -03:00
Jacopo b996a82ff4 ProjectsFinder should handle more options
Extended ProjectFinder in order to handle the following options:
 - current_user - which user use
 - project_ids_relation: int[] - project ids to use
 - params:
   -  trending: boolean
   -  non_public: boolean
   -  starred: boolean
   -  sort: string
   -  visibility_level: int
   -  tags: string[]
   -  personal: boolean
   -  search: string
   -  non_archived: boolean

GroupProjectsFinder now inherits from ProjectsFinder.
Changed the code in order to use the new available options.
2017-04-06 07:11:37 +02:00
Rémy Coutable 63360adeae
Add `requirements: { id: %r{[^/]+} }` for all projects and groups namespaced API routes
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-03-16 18:00:24 +01:00
Toon Claes 6357635686 Rename query parameter to `membership`
The query parameter `membership` should be more self-explaining.
2017-03-03 13:42:39 +01:00
Toon Claes a3fdd6acd2 Use string based `visibility` getter & setter
Add `visibility` & `visibility=` methods to the
`Gitlab::VisibilityLevel` module so the `visibility_level` can be
get/set with a string value.
2017-03-02 12:15:25 +01:00
Toon Claes b2c2dfe545 Expose Project's & ProjectSnippet's VisibilityLevel as String
Instead of exposing the VisibilityLevel as Integer, expose it as
String `visibility` for Project and ProjectSnippet.

Filter queries also accept the `visibility` as String instead of
`visibility_level` as Integer.

Also remove the `public` boolean.
2017-03-02 09:33:24 +01:00
James Lopez a0101ebf84 Update occurrences of MWBS to MWPS
Rename column in the database
 Rename fields related to import/export feature
 Rename API endpoints
 Rename documentation links
 Rename the rest of occurrences in the code
 Replace the images that contain the words "build succeeds" and docs referencing to them
 Make sure pipeline is green and nothing is missing.

updated doc images

renamed only_allow_merge_if_build_succeeds in projects and fixed references

more updates

fix some spec failures

fix rubocop offences

fix v3 api spec

fix MR  specs

fixed issues with partials

fix MR spec

fix alignment

add missing v3 to v4 doc

wip - refactor v3 endpoints

fix specs

fix a few typos

fix project specs

copy entities fully to V3

fix  entity error

more fixes

fix failing specs

fixed missing entities in V3 API

remove comment

updated code based on feedback

typo

fix spec
2017-03-01 12:02:02 +01:00
Sean McGivern 0226fb0e1f Merge branch '6073_project_api' into 'master'
API project create: Make name or path required

Closes #6073

See merge request !9416
2017-02-28 16:29:00 +00:00
Robert Schilling 86c58687b2 Return 204 for delete endpoints 2017-02-28 08:32:38 +01:00
Jarka Kadlecova 08ee177d6f API project create: Make name or path required 2017-02-27 07:55:45 +01:00
Oswaldo 2b001d9e7a Return 202 with JSON body on async removals on V4 API 2017-02-23 19:55:13 -03:00
Douwe Maan 99a34a52d7 Enable Style/MultilineArrayBraceLayout 2017-02-23 09:32:22 -06:00
Douwe Maan c10064aad5 Enable Style/SpaceInsideBrackets 2017-02-23 09:31:56 -06:00
Mark Fletcher d3425933dd Add housekeeping endpoint for Projects API 2017-02-22 17:40:20 +05:30
Robert Schilling 039c6d60fa API: Moved `DELETE /projects/:id/star` to `POST /projects/:id/unstar` 2017-02-20 15:14:48 +01:00
Toon Claes 4e9e29d295 API: Consolidate /projects endpoint
It consolidates these endpoints:
 - /projects
 - /projects/owned
 - /projects/visible
 - /projects/starred
 - /projects/all

Into the /projects endpoint using query parameters.
2017-02-14 16:41:57 +01:00
Oswaldo Ferreira c2102e6e3b Move /projects/fork/:id to /projects/:id/fork 2017-02-13 16:58:11 -02:00
Toon Claes c6ad83ec29 API: remove `public` param for projects
The create and edit actions for projects had these parameters:

- `public` (optional) - if true same as setting `visibility_level = 20`
- `visibility_level` (optional)

Remove the `public` parameter to avoid contradiction.
2017-02-07 14:29:31 +01:00
Oswaldo Ferreira cc24682b58 Unify projects search by removing /projects/:search endpoint 2017-01-30 11:22:15 -02:00
Robert Speicher 55b3ee7439 Merge branch 'sandish/gitlab-ce-update_ret_val' into 'master'
Ensure updating project settings shows a flash message on success

See merge request !8579
2017-01-16 18:28:23 +00:00
Rémy Coutable 7485cec94e
Add a spec and actually display the flash notice
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-01-16 10:57:15 -05:00
Rémy Coutable 281f3fcfd5 Merge branch 'dot-in-project-queries' into 'master'
Add a constraint on the query parameter to allow querying for projects with dots in their name.

See merge request !8210
2017-01-16 00:03:01 +00:00
Bruno Melli 322534aa94 Add a constraint on the query parameter to allow querying for projects with dots in their name. 2017-01-14 23:13:39 -07: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
Rémy Coutable d757247247
Allow public access to some Project API endpoints
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-01 16:39:42 +01:00
Robert Schilling 7c607a55ab Grapify the projects API 2016-11-28 21:01:43 +01:00
Rémy Coutable 4f5ed81232
API: Introduce `#find_project!` which also check access permission
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-24 14:40:35 +01:00
Robert Schilling eff1b05ab1 API: Add endpoint to delete a group share 2016-11-23 12:53:37 +01:00
Rodolfo Santos 1db9f826c1 Add setting to only allow merge requests to be merged when all discussions are resolved
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-11-04 14:58:40 +01: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
Sean McGivern 0a1baaa80f Tidy up project list actions 2016-10-05 12:13:58 +01:00
Ben Boeckel e956a24dfd api: add /projects/visible API endpoint
FIxes #19361, #3119.
2016-10-04 17:23:18 +01:00
Felipe Artur 93d849beae Expose project share expiration_date field on API 2016-09-28 10:12:49 -03: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
Felipe Artur e0067d1850 Allow to set request_access_enabled for groups and projects using API 2016-09-19 12:13:57 -03:00
Rémy Coutable 3a58dd2d8f
Use Search::GlobalService.new in the `GET /projects/search/:query` endpoint
Also streamline the sorting part while we're at it.

That being done, there's currently a duplication between
`GET /projects/search/:query` and `GET /projects?search=:search`
so we might want to keep only the latter for 9.0...

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-09-12 10:34:03 +02:00
Razzeee 874ad681cd Search should compare only the lowercase versions of the project names 2016-09-09 15:19:18 +02:00
Olaf Tomalka 636db1515c Higher code quality for fork to namespace API 2016-09-06 23:51:08 +02:00