Commit Graph

427 Commits

Author SHA1 Message Date
Stephan van Leeuwen 6af34b0f71 Changed setting the sort variable
Changed from using cases to set the sort variable, to use a one line if/else statement
2014-12-29 16:36:56 +01:00
Stephan van Leeuwen 6b50721946 Updated projects api to allow ordering
Added support for order_by and sort parameters, to sort the projects by the specified values.
Updated projects api documentation including the order_by and sort parameters
2014-12-29 16:36:56 +01:00
Ciro Santilli e375d0de65 Typo in project API events comment 2014-11-14 09:33:33 +01:00
Vinnie Okada 41518a467d Remove :keep_repo option
Always delete repositories from the filesystem when deleting a project.
2014-10-22 21:08:19 -05:00
Vinnie Okada 68b5ac7f18 Add option to keep repo on project delete
Update the project API controller to use `Projects::DestroyService`
instead of calling `Project#destroy` directly.

Also add an optional parameter, `:keep_repo`, that allows a project to
be deleted without deleting the repository, wiki, and satellite from
disk.
2014-10-07 15:21:00 -05:00
Bernhard Kaindl f030ee846e API: Initial support for forking a project via the API
This change adds POST /projects/fork/:id to the API for forking
a project into the namespace of the authenticated user, like the
"create fork" link in the GUI does. It also calls the same code.

Failure and permission checks (except for conflict) are already
implemented and handled in ForkService and the API, so the added
code is simple and does not alter anything.
2014-10-01 10:27:48 +02:00
jubianchi 998cd3cb63 Improve error reporting on users API
* users (#6878, #3526, #4209): Validation error messages are now exposed through 400 responses, 409 response are sent in case of duplicate email or username
* MRs (#5335): 409 responses are sent in case of duplicate merge request (source/target branches), 422 responses are sent when submiting MR fo/from unrelated forks
* issues
* labels
* projects
2014-09-16 01:25:24 +02:00
Robert Schilling 9284038dbe Add, delete labels via API 2014-08-13 12:28:19 +02:00
Dmitriy Zaporozhets f8eedb4cda
Cleaner variable name
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-08-11 15:25:25 +03:00
Dmitriy Zaporozhets d10ecacc47 Merge branch 'master' into 'master'
Let users limit by archived/not archived projects in GitLab API GET /projects

Adds a boolean parameter, archived, to the /projects endpoint.

See merge request !158
2014-08-11 09:27:24 +00:00
Dmitriy Zaporozhets 70f868b737
Fix tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-07-30 16:05:43 +03:00
Sasha Joseph 37c4ba6f8d Add an option to GET /projects in the GitLab API to exclude archived projects 2014-07-28 12:48:13 -04:00
Dmitriy Zaporozhets 66098dbb59 Merge pull request #7089 from NARKOZ/api-patch
API patch
2014-07-23 20:26:36 +03:00
Dmitriy Zaporozhets ae564c97d4
Dont expose user email via API
To prevent leaking of users info we reduce amount of user information
retrieved via API for normal users.

What user can get via API:

* if not admin: only id, state, name, username and avatar_url
* if admin: all user information
* about himself: all informaion

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-13 17:46:48 +03:00
Dmitriy Zaporozhets 1355ede49d
Wipe wall notes feature
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-06-13 14:24:54 +03:00
Nihad Abbasov 7040a42cfc API: ability to set an import url when creating project for a specified user 2014-06-06 06:31:55 +05:00
Ábner Silva de Oliveira e153469f31 changed doc comment for get labels of a project 2014-03-23 19:07:18 -03:00
Ábner Silva de Oliveira 44aa6b90dd added api method to return labels of a given project 2014-03-21 06:25:25 -03:00
Dmitriy Zaporozhets eea317795e
Add current user permissions info to /api/projects/:id.json
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-03-17 14:33:41 +02:00
Dmitriy Zaporozhets 7c60713e82
Move project members api to separate file
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-03-17 13:44:54 +02:00
Dmitriy Zaporozhets f0f88390c1
project_user selectbox with ajax autocomplete
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-02-13 16:08:26 +02:00
skv a3f645ef51 Remove deprecated finders 2014-01-19 23:39:56 +04:00
Dmitriy Zaporozhets efa10c819d
Replace context with service in lib
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2014-01-16 20:35:21 +02:00
Maxime Brugidou 56d4788264 Add import_url param in API projects create 2013-12-09 11:07:32 +01:00
Jason Hollingsworth d9bb4230cc Adding authenticated public mode (internal).
Added visibility_level icons to project view (rather than just text).
Added public projects to search results.
Added ability to restrict visibility levels standard users can set.
2013-11-26 22:22:07 -06:00
Dmitriy Zaporozhets a09fc160d0
Add project.all for API if admin
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-18 14:15:59 +02:00
Dmitriy Zaporozhets cfa15d0846
Remove default_branch support from API project creation
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2013-11-06 19:14:11 +02:00
Dmitriy Zaporozhets c8e7d6df79 API: new feature - remove project[D 2013-10-09 14:41:41 +03:00
Izaak Alpert 04c7c262a7 Used pagnation function from api helpers
Change-Id: I1bdd3608d3b46924b5da3ae282c99f85ee4e0dab
2013-09-24 09:22:46 -04:00
Izaak Alpert 4cfbfbb845 Added search for projects by name to api
GITLAB-1283 (GITLAB-869)

Change-Id: I611e7e93f6292de08e1edc8d3ea77cf9087b6ded

Conflicts:
	config/initializers/1_settings.rb
2013-09-23 19:36:25 -04:00
Dmitriy Zaporozhets d6aec3fc1a Allow specify path when create project via api 2013-08-14 13:41:06 +03:00
Angus MacArthur ace5c54ab9 enhance project creation apis to allow setting of public attribute
Change-Id: Ib71ce8cf993627eada63d7d596fb302ec702f36e
2013-07-12 12:10:42 -04:00
Dmitriy Zaporozhets 8cdfa86b57 Merge pull request #3993 from bke-drewb/3599
Issue 3599: Add snippets_enabled flag to projects for API
2013-07-11 09:54:15 -07:00
Angus MacArthur ea5a006f27 Additon of apis for fork administration.
Added ability to add and remove the forked from/to relatioinship
between existing repos.
2013-07-08 17:34:00 -04:00
Drew Blessing 31b06ebd01 Issue 3599: Add snippets_enabled flag to projects for API
s 3599: Add snippets_enabled flag to projects for API

Replace missing comma
2013-06-11 21:38:02 -05:00
Dmitriy Zaporozhets 8df699a336 API: project events 2013-06-06 19:19:17 +03:00
Dmitriy Zaporozhets b05600f28b Split Project api on several parts: deploy_keys, hooks, snippets etc 2013-06-06 12:37:51 +03:00
babatakao 37a90d5f76 Selectable deploy keys contain master projects 2013-06-05 02:59:30 +09:00
Dmitriy Zaporozhets bcc4e4dc7e Merge branch 'gist' of https://github.com/Andrew8xx8/gitlabhq into Andrew8xx8-gist
Conflicts:
	Gemfile.lock
	app/models/ability.rb
	app/models/project.rb
	app/views/snippets/_form.html.haml
	db/schema.rb
	features/steps/shared/paths.rb
	spec/factories.rb
	spec/models/project_spec.rb
2013-06-04 18:36:22 +03:00
Dmitriy Zaporozhets 0611c5c612 Fix deploy key api 500 if key is empty 2013-06-03 21:01:07 +03:00
Dmitriy Zaporozhets 50e8d6c0c0 Add api to collect owned user projects. Api deploy_key.create: Enable deploy key if it exist in other owned project 2013-06-03 19:49:04 +03:00
Dmitriy Zaporozhets 068cf2f467 split repositories and projects api 2013-05-23 12:23:47 +03:00
Dmitriy Zaporozhets 634cbd7138 Refactor API classes. So api classes like Gitlab::Issues become API::Issues 2013-05-14 15:33:31 +03:00
Nihad Abbasov 77d0e41df0 fix API route to delete project hook 2013-05-07 00:09:23 +05:00
Dmitriy Zaporozhets 4528fa9817 modify api to work with new deploy keys 2013-05-06 16:24:58 +03:00
Dmitriy Zaporozhets dfeef6c228 Fixed API file raw functionality, Fixed tree controller tests. Added BlobController specs 2013-04-03 15:55:08 +03:00
Dmitriy Zaporozhets 541d899410 Project.repository should never be nil so you can call repository.exists? or repository.empty?
Also specify separate project factory for project with filled repo
2013-04-01 16:56:25 +03:00
Andrew8xx8 d4543eb5a7 Tests fixed 2013-03-25 11:20:14 +04:00
Alex Denisov 28e7d1a8bf Abilities added to /user and /sign_in requests 2013-03-18 20:11:28 +00:00
Sebastian Ziebell ecf53bb9e6 API: fixes project creation and removed redundant info 2013-03-07 15:11:33 +01:00
Sebastian Ziebell 3374027e3a Merge branch 'master' into fixes/api, code clean up and tests fixed
Conflicts:
	doc/api/projects.md
	spec/requests/api/projects_spec.rb
2013-03-07 14:51:56 +01:00
Dmitriy Zaporozhets 7c408960ce Merge pull request #3146 from amacarthur/AdminAPIs
Additional Admin APIs
2013-03-06 22:57:24 -08:00
Sebastian Ziebell b5ef6d2268 API: refactored and simplified error handling in merge requests API 2013-03-05 23:43:05 +01:00
Sebastian Ziebell cce35b6d05 Fixes api 2013-03-05 22:33:45 +01:00
Sebastian Ziebell 61cfa2a7a6 Merge branch 'master' into fixes/api
Conflicts:
	lib/api/projects.rb
2013-03-05 22:29:49 +01:00
Matt Humphrey f411772e33 Project deploy keys API 2013-03-05 21:23:29 +00:00
Angus MacArthur 61ffcab60f Additional Admin APIs 2013-03-05 10:38:43 -05:00
Matt Humphrey 1c0c7bd6e3 Missed comma. 2013-03-01 16:36:19 +00:00
Matt Humphrey dd653f62f3 Added namespace_id to project creation via API
This allows you to set the namespace ID for projects via the the API. By default it is created for the current user. You can assign it to the global namespace by passing `GLN` which translates to 'Global Namespace'.
2013-03-01 16:34:11 +00:00
Sebastian Ziebell 3bb342b961 Merge branch 'master' into fixes/api 2013-02-27 17:52:59 +01:00
Sebastian Ziebell 7499f65014 API: extracted helper method to validate required parameters, code clean up
Added a helper method to check if required parameters are given in an API call. Can be used
to return a `400 Bad Request` return code if a required attribute is missing.
Code clean up and fixed tests.
2013-02-27 17:50:30 +01:00
Nihad Abbasov 3c5954b8c8 proper fix for #2300 2013-02-27 06:47:04 -08:00
Sebastian Ziebell 07f306d8af Merge branch 'master' into fixes/api 2013-02-27 15:15:47 +01:00
Nihad Abbasov 8d847b89d2 API: fix commits pagination
closes #2300
2013-02-27 06:00:33 -08:00
Sebastian Ziebell e119b0a0cb API repository documentation updated, includes infos to return codes
The API documentation of repository is updated and now contains infos to status codes.
Code documentation is also adjusted for `GET /projects/:id/repository/commits` and includes infos to
pagination attributes. Tests are updated.
2013-02-27 11:24:12 +01:00
Sebastian Ziebell f0e417091c Merge branch 'master' into fixes/api
Conflicts:
	spec/requests/api/projects_spec.rb
2013-02-20 14:30:11 +01:00
Sebastian Ziebell eefb27f5ae Merge branch 'master' into fixes/api
Conflicts:
	spec/requests/api/projects_spec.rb
2013-02-20 12:43:32 +01:00
Matt Humphrey 33c513274d Fix RESTfulness of project hook deletions by API 2013-02-20 11:35:36 +00:00
Sebastian Ziebell e9d3b96595 API: fixes visibility of project hook
When a user is not authorized to see the list of hooks for a project, he is
still able to access the hooks separately. For example if access to
`GET /projects/:id/hooks` fails and returns a `403 Unauthorized` error it is
still possible to access a hook directly via `GET /projects/:id/hooks/:hook_id`.

Fixes access, also added tests to check access and status codes of hooks.
2013-02-16 14:42:49 +01:00
Sebastian Ziebell c305eb31aa API: tests that check status codes for project branches and hooks
Status code 422 (Unprocessable Entity) returned if invalid url is given when creating
or updating a project hook.
2013-02-14 16:55:33 +01:00
Sebastian Ziebell 6df02adc7a API: status code 403 returned if new project would exceed limit
When the project limit is reached the user is not allowed to create new ones.
Instead of error code 404 the status code 403 (Forbidden) is returned with error
message via API.
2013-02-14 15:51:56 +01:00
Sebastian Ziebell 6fc3263e15 API: extracted helper method to provide 400 bad request error with description
Extracted a method for 400 error (Bad request) and adjusted code accordingly. The name of
the missing attribute is used to show which one was missing from the request. It is used to
give an appropriate message in the json response.
2013-02-13 15:48:52 +01:00
Sebastian Ziebell 54ab9bb6df API: return status code 400 if filepath of raw file blob not given 2013-02-13 14:47:59 +01:00
Sebastian Ziebell fd01f3aacd API: fixes a few return codes for project snippets
When using project snippets via API the functions now provide status codes for
different situations other then only returning 404 error. If required parameters are missing,
e.g. `title` when creating a project snippet a 400 (Bad request) error is returned. The snippet
delete function now is idempotent and returns a 200 (Ok) regardless if the snippet with the
given id is available or not. Changing return codes of these functions has the advantage that
the 404 error is used only for resources, which are not available.

Tests added to check these status codes when handling project snippets.
2013-02-13 12:09:16 +01:00
Sebastian Ziebell 375caeefcf Merge branch 'master' into fixes/api 2013-02-13 10:31:06 +01:00
Sebastian Ziebell 7cc4339f71 API: changed status codes for project hooks functions
Different status codes in the API lib are returned on hook creation, update or deletion.
If a required parameter is not given (e.g. `url` in `/projects/:id/hooks/:hook_id`) status
code 400 (Bad request) is returned. On hook deletion a 200 status code is returned, regardless if
the hook is present or not. This makes the DELETE function an idempotent operation. Appropriate tests
are added to check these status codes.
2013-02-12 17:44:42 +01:00
Sebastian Ziebell 2bd955961c Changed function to `not_found`.
Instead of using funtion `error!` the function `not_found!` is used to return 404 error. Adjusted documentation accordingly.
2013-02-09 21:01:17 +01:00
Sebastian Ziebell 40e7846f3e Status code 404 returned when retrieving non existent branch (issue #2922)
Accessing a repository branch that does not exist returns a 404 error instead
of 200 now. Added a test.
2013-02-08 17:04:08 +01:00
Sebastian Ziebell 9544f90389 Adding a project hook returns status code 400 if url is not given
When adding a project hook a url must be specified or a 400 error code is returned

* Specs added to check status code on handling project hooks
* refactored code, extracted a method
2013-02-08 16:48:05 +01:00
Sebastian Ziebell 818caf0b5d API: refined status code handling when adding or updating a project member
When a user is added to a project that is already a member of, a status code 201 is now returned to
signal an idempotent operation. If something fails then instead of returning error code 404 different
more specific error codes are returned. Status code 400 (Bad request) is returned when a required
attribute, e.g. `access_level` is not given or 422 if there is a semantic error, e.g. should
the `access_level` have an unsupported value.

Specs are added to check these status codes.
2013-02-08 14:33:29 +01:00
Sebastian Ziebell 8045a81bcf Merge branch 'master' into fixes/api 2013-02-08 10:32:42 +01:00
Felix Gilcher ce6436b98a Don't crash when removing a user that's not project member
The attempt to revoke project access for a user that was not member of the
project results in a 500 Internal Server error where it actually should
result in a 200 OK since after the operation, the user is not member of
the project. This turns the operation into an idempotent call that can
be repeated with no ill effects.

Updated the spec and changed the code accordingly. However, the result differs
slightly, as we can't return the users project access level if the user was not
member. I'm not aware if anybody relies on the result of this call.

Fixes #2832
2013-02-01 13:53:35 +00:00
Matt Humphrey 2c7554e897 Added methods to protect and unprotect branches 2013-01-31 09:26:03 +00:00
Dmitriy Zaporozhets 6f05ea4f6e Improve CreateContext call. Fixed test 2013-01-18 20:21:13 +02:00
GitLab 232d61d598 Refactor project creation. Added logout link to profile page 2013-01-17 17:35:57 +02:00
Dmitriy Zaporozhets afbdbb0c95 Rspec fixes 2013-01-04 18:50:31 +02:00
Dmitriy Zaporozhets d431e43392 Fix few bugs and tests after refactoring ownership logic 2013-01-02 19:32:34 +02:00
Riyad Preukschas 056fa05b86 Remove path parameter from projects API 2012-12-22 20:06:18 +01:00
Riyad Preukschas 8f01190eb5 Remove all references tp the project code parameter from the API 2012-12-21 18:47:04 +01:00
Riyad Preukschas 931ec399bd Remove the code parameter from the projects API 2012-12-21 18:43:46 +01:00
Valeriy Sizov 77d632890b refactoring gfm_autocomplete 2012-12-20 20:52:12 +02:00
Dmitriy Zaporozhets 0e1635a68a Fixing requests after namespaces. Fixed admin bug with access to project 2012-11-23 22:25:28 +02:00
Dmitriy Zaporozhets 9304d049de Fixed some tests and snippet colorize 2012-11-23 22:31:09 +03:00
Saito 6cec9ed328 linguist will take care of this 2012-11-10 01:36:55 +08:00
jozefvaclavik d1a18d038d Update lib/api/projects.rb
Added methods for listing one project hook and editing hooks.
GET /project/:id/hooks/:hook_id
PUT /project/:id/hooks/:hook_id
2012-10-12 10:30:09 +03:00
Nihad Abbasov 61f12da3a5 API: add project snippets listing 2012-10-08 02:13:53 -07:00
Nihad Abbasov ad5b5d1e51 projects API should return info about deleted hook 2012-10-08 01:54:50 -07:00
Nihad Abbasov 4a072be2d7 API: commits belong to project repository 2012-09-21 04:34:07 -07:00
Dmitriy Zaporozhets 131553627d Merge pull request #1521 from NARKOZ/api
API for project team members
2012-09-21 04:19:16 -07:00
Nihad Abbasov 25b745271a add API for project team members 2012-09-21 03:23:17 -07:00
Dmitriy Zaporozhets 10d3a30b25 APi for commits. Better api docs 2012-09-21 13:22:30 +03:00
Alex Denisov b896880eb4 Method name changed 2012-09-16 20:08:57 +03:00
Alex Denisov 549c4c2202 API attributes refactored 2012-09-16 19:51:04 +03:00
miks 6d76e000d0 Add authorization to hooks requests 2012-09-10 16:50:01 +03:00
miks 2e34a6d3c4 Merge branch 'master' into project_hooks_api 2012-09-10 16:47:31 +03:00
Alex Denisov 915dac0055 Error throwing moved to api_helper 2012-09-10 10:41:46 +03:00
randx b565f33472 Auth for API 2012-09-10 09:06:11 +03:00
miks 3b5a90bdf6 Projects hooks API implemented 2012-09-08 20:51:12 +03:00
miks 27e4436507 Return empty body 2012-09-08 20:01:08 +03:00
miks 4226458faf Merge branch 'master' into project_users_api 2012-09-08 10:50:24 +03:00
miks 909c8c345d Make project users API more RESTful 2012-09-06 23:49:29 +03:00
miks e3b1f62c6b convert params hash to array 2012-09-06 00:13:25 +03:00
miks 8f7360f390 API on adding users to project implemented 2012-09-05 23:01:03 +03:00
Alex Denisov 9b9dd3f9bf Unnecessary code removed 2012-09-05 11:44:47 +03:00
Alex Denisov e078a173d6 Create project via API: fixes added 2012-09-03 18:00:24 +03:00
Nihad Abbasov 76e4d94d43 add pagination to API 2012-09-03 04:46:29 -07:00
Alex Denisov 9811e64d71 Typo and mistakes fixed 2012-08-31 11:11:12 +03:00
Alex Denisov c1173e2707 API on Projects creation implemented 2012-08-31 10:15:37 +03:00
Robert Speicher 7754189187 Fully embrace Ruby 1.9 hash syntax
Didn't bother with files in db/, config/, or features/
2012-08-10 18:25:15 -04:00
Nihad Abbasov 058b71edf3 API: set content type for raw snippet 2012-08-01 05:57:56 -07:00
Nihad Abbasov 853ca74620 fix typo according to docs and tests 2012-08-01 05:48:15 -07:00
Jeremy Anderson 69c4cea65a updating project api to include raw blob contents and single branch 2012-07-31 07:32:44 -07:00
Nihad Abbasov 949b1df930 API: update docs 2012-07-25 02:35:41 -07:00
Nihad Abbasov 0f604e62fb refactor projects API 2012-07-06 06:36:43 -07:00
Nihad Abbasov 61910eb8fa ability to update and get a raw snippet via API 2012-07-04 02:03:32 -07:00
Nihad Abbasov 378dc55d29 add project snippets API 2012-06-29 06:34:08 -07:00
Nihad Abbasov 0d67f209fc refactor API and improve docs 2012-06-29 03:46:01 -07:00