Commit Graph

533 Commits

Author SHA1 Message Date
bugagazavr 548f182814 Added X-GitLab-Event header for web hooks 2015-04-25 21:31:52 +03:00
Douwe Maan 8ed7ac9d44 Use project.commit convenience method. 2015-04-24 12:29:36 +02:00
Douwe Maan 84a1590252 Let commit model know about its project. 2015-04-24 12:29:36 +02:00
Douwe Maan 2b2bd402dc Track who created a group or project member. 2015-04-14 12:06:42 +02:00
Douwe Maan e6569defe6 Use through-relation instead of manually mapping. 2015-04-14 12:05:50 +02:00
Douwe Maan ff3caad4ca Rename manage_group ability to admin_group for consistency with project. 2015-04-14 12:05:49 +02:00
Christoph Dreis 1fdc610fa5 Include creator_id in project info of API 2015-04-10 18:35:05 +02:00
Cristian Medina f045490568 Modified lib/api/entities.rb to expose Project class tag_list property to the API
Updated projects.md to show tag_list field when performing GETs
Updated projects_spec.rb to include check for tag_list key in project list
Added changes to the CHANGELOG
2015-04-03 04:35:12 -04:00
Dmitriy Zaporozhets 424cbf46d5 Merge branch 'repository-archive-worker' into 'master'
Archive repositories in background worker.

Depends on https://gitlab.com/gitlab-org/gitlab_git/merge_requests/17 being merged, a new `gitlab_git` being released and this MR's `Gemfile.lock` being updated..

See private issue https://dev.gitlab.org/gitlab/gitlabhq/issues/2173.

To do after this is merged: Update https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/gitlab/templates/default/sv-sidekiq-run.erb in omnibus.

See merge request !436
2015-04-02 20:30:55 +00:00
Dmitriy Zaporozhets eb2339a401 Merge pull request #9023 from dantudor/patch-1
Allow ability to delete branches with '/` in name
2015-03-31 19:30:15 +03:00
Dan Tudor a6c6335671 Added the missing comma 2015-03-31 17:08:33 +01:00
Douwe Maan 2cfd0b59ae Archive repositories in background worker. 2015-03-31 12:52:20 +02:00
Douwe Maan fe7992a524 Merge branch 'events-paginate' into 'master'
API: Events paginate

Updated the api method for /project/:id/events, to use the paginate method instead of limiting and offsetting the recent events in the method itself.

This will also change the first page to be 1 instead of 0, but using 0 will still work and will give back the first page.
This also add's the link headers (next/first/last).

See merge request !267
2015-03-30 19:01:03 +00:00
Nihad Abbasov bba2b10eb5 properly paginate project events in API 2015-03-29 05:36:53 +05:00
Dmitriy Zaporozhets d41b2085fe Merge branch 'master' into 'master'
Change ordering so that confirm is removed from attrs before attempting to User.build_user

Possible fix gitlab-org/gitlab-ce#1296

See merge request !445
2015-03-26 01:14:54 +00:00
Dmitriy Zaporozhets f729f60447 Merge branch 'more-rubocop-styles' into 'master'
More rubocop styles

See merge request !449
2015-03-25 15:37:04 +00:00
Dan Tudor 00dd44455a Allow ability to delete branches with '/` in name 2015-03-25 15:15:26 +00:00
Dmitriy Zaporozhets 8f3f6e9efb Merge branch 'api-internal-errors' into 'master'
Respond with full GitAccess error if user has project read access.

Should help with debugging #1236.

cc @marin

See merge request !437
2015-03-25 04:16:45 +00:00
Dmitriy Zaporozhets 6ec8ff069c Enable more rubocop style checks 2015-03-24 18:28:10 -07:00
Stephan van Leeuwen 3b3662da0a Updated api method GET /projects/:id/events to use paginate instead of a self-implementation
Also updated example request url

Added changelog item
2015-03-24 19:11:48 +01:00
RICKETTM@uk.ibm.com fda55f9145 Change ordering so that confirm is removed from attrs before attempting to User.build_user 2015-03-24 15:52:26 +00:00
Douwe Maan 4745424bd3 Respond with full GitAccess error if user has project read access. 2015-03-24 14:12:03 +01:00
Douwe Maan 4830b2be5e Refactor GitAccess to use instance variables. 2015-03-24 14:11:48 +01:00
Dan Tudor 862e1e6f17 Unescape branch param to delete
Branch names that contain `/` return a 405 error when being deleted because the slash is escaped to `%2F`
This patch will unescape the param prior to  executing the delete action.
2015-03-24 13:04:22 +00:00
Dmitriy Zaporozhets 648f38cd98 Merge branch 'fix-restricted-visibility' into 'master'
Restricted visibility levels - bug fix and new feature

This allows admin users to override restricted visibility settings when creating and updating projects and snippets, and moves the restricted visibility configuration from gitlab.yml to the web UI.  See #1903.

## Move configuration location

I added a new section to the application settings page for restricted visibility levels.  Each level has a checkbox, styled with Bootstrap to look like a toggle button.  A checked box means that the level is restricted.  I added a glowing text shadow and changed the background color for checked buttons because the default styles made it hard to distinguish between checked and unchecked.  This image shows the new section with the "Public" box checked:

![restricted_visibility_settings](https://dev.gitlab.org/Okada/gitlabhq/uploads/629562e4313f89b795e81c3bb0f95893/restricted_visibility_settings.png)

## Allow admins to override

To allow admin users to override the restricted visibility levels, I had to remove the `visibility_level` validation from the `Project` class.  The model doesn't know about the `current_user`, which should determine whether the restrictions can be overridden.  We could use the creator in the validation, but that wouldn't work correctly for projects where a non-admin user is the creator and an admin tries to change the project to a restricted visibility level.

The `Project::UpdateService` and `Project::CreateService` classes already had code to determine whether the current user is allowed to use a given visibility level; now all visibility level validation is done in those classes.  Currently, when a non-admin tries to create or update a project using a restricted level, these classes silently set the visibility level to the global default (create) or the project's existing value (update).  I changed this behavior to be more like an Active Model validation, where using a restricted level causes the entire request to be rejected.

Project and personal snippets didn't have service classes, and restricted visibility levels weren't being enforced in the model or the controllers.  The UI disabled radio buttons for restricted levels, but that wouldn't be difficult to circumvent.  I created the `CreateSnippetService` and `UpdateSnippetService` classes to do the same restricted visibility check that the project classes do.  And since I was dealing with snippet visibility levels, I updated the API endpoints for project snippets to allow users to set and update the visibility level.

## TODO

* [x] Add more tests for restricted visibility functionality

cc @sytse @dzaporozhets

See merge request !1655
2015-03-16 17:49:46 +00:00
Douwe Maan 31fc73f0a9 Use `project_member` instead of `team_member`. 2015-03-15 13:50:38 +01:00
Douwe Maan 99f995755e Use `group_member` instead of `users_group` or `membership`. 2015-03-15 13:49:41 +01:00
Vinnie Okada ad0ca0499a Merge branch 'master' into fix-restricted-visibility
Conflicts:
	db/schema.rb
2015-03-14 10:49:11 -06:00
Vinnie Okada 9623b71a39 More restricted visibility changes
Bug fixes and new tests for the restricted visibility changes.
2015-03-10 18:36:43 -06:00
Vinnie Okada 928fc94c3d Enforce restricted visibilities for snippets
Add new service classes to create and update project and personal
snippets.  These classes are responsible for enforcing restricted
visibility settings for non-admin users.
2015-03-08 17:57:08 -06:00
Vinnie Okada 285c534185 Allow admins to override restricted visibility
Allow admins to use restricted visibility levels when creating or
updating projects.
2015-03-08 16:10:05 -06:00
Jörg Thalheim 9f089ac48c use constant-time string compare for internal api authentication
Ruby str_equal uses memcmp internally to compare String.
Memcmp is vunerable to timing attacks because it returns early
on mismatch (on most x32 platforms memcmp uses a bytewise comparision).
Devise.secure_compare implements a constant time comparision instead.
2015-03-06 20:06:26 +01:00
Dmitriy Zaporozhets 8c47a72a4e Merge branch 'project-existence-leak' into 'master'
Don't leak information about private project existence via Git-over-SSH/HTTP.

Fixes #2040 and https://gitlab.com/gitlab-org/gitlab-ce/issues/343.

Both `Grack::Auth` (used by Git-over-HTTP) and `Api::Internal /allowed` (used by gitlab-shell/Git-over-SSH) now return a generic "Not Found" error when the project exists but the user doesn't have access to it.

See merge request !1578
2015-03-03 20:05:12 +00:00
Dmitriy Zaporozhets 8348e1a9b5 Enable ParenthesesAsGroupedExpression rule 2015-03-02 18:45:28 -08:00
Douwe Maan dd37a10df4 Don't leak information about private project existence via Git-over-SSH/HTTP. 2015-03-02 17:52:48 +01:00
Jeroen van Baarsen 93bacb03e5 Merge pull request #8890 from sue445/feature/project_api_avatar_url
Expose avatar_url in projects API
2015-03-01 10:54:42 +01:00
sue445 51abeaa1bc Expose avatar_url in projects API
* Impl Project#avatar_url
* Refactor ApplicationHelper: Use Project#avatar_url
* Update changelog
2015-03-01 10:13:01 +09:00
Dmitriy Zaporozhets 0d22b75b03 Merge branch 'master' into mmonaco/gitlab-ce-api-user-noconfirm
Conflicts:
	lib/api/users.rb
2015-02-27 13:01:57 -08:00
Vinnie Okada 5f232b5687 Improve error messages when file editing fails
Give more specific errors in API responses and web UI flash messages
when a file update fails.
2015-02-22 16:01:49 -07:00
Dmitriy Zaporozhets 558dd81197 Improve broadcast message API 2015-02-18 14:58:20 -08:00
Dmitriy Zaporozhets 833d4dddf2 Dont send 404 if no broadcast messages now because it flood gitlab-shell logs with 404 errors :( 2015-02-18 14:34:05 -08:00
Dmitriy Zaporozhets 24d939afb9 Remove Group#owner_id from API since it is not used any more 2015-02-17 16:23:44 -08:00
Vinnie Okada b0dacc8eb0 Edit group members via API
Add an API endpoint to update the access level of an existing group
member.
2015-02-11 18:53:07 -07:00
Douwe Maan 42422dcc6a Add internal broadcast message API. 2015-02-07 16:41:30 +01:00
Dmitriy Zaporozhets bdfb349ff7 Refactor and improve sorting objects in API for projects, issues and merge requests 2015-02-05 22:00:54 -08:00
Dmitriy Zaporozhets 62ed1c537e Explicitly define ordering in models using default_scope 2015-02-05 14:20:55 -08:00
Dmitriy Zaporozhets fc13ea7137 Merge pull request #8712 from jvanbaarsen/add-merge-request-files-endpoint
Added a way to retrieve MR files
2015-02-04 14:46:54 -08:00
Jeroen van Baarsen b60d06eb2c Added a way to retrieve MR files
Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
2015-02-04 10:24:25 +01:00
Dmitriy Zaporozhets dc9bf32420 Merge pull request #8723 from jubianchi/api-groups-path
Access groups using path
2015-02-03 10:57:27 -08:00
jubianchi 4e97f26649 Acces groups with their path in API 2015-02-03 13:42:38 +01:00