Commit Graph

262 Commits

Author SHA1 Message Date
Rémy Coutable 103114e3d7 Rename Gogs to Gitea, DRY the controller and improve views
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-19 17:35:51 +01:00
Kim "BKC" Carlbäcker 5d4531db25 Gogs Importer 2016-12-19 17:35:51 +01:00
Valery Sizov 32c6c9c457 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into bitbucket-oauth2 2016-11-30 14:53:30 +02:00
Douwe Maan a7a9db803b Merge branch 'dz-allow-nested-group-routing' into 'master'
Add nested groups support to the routing

## What does this MR do?

It allows routing with `/` in namespace name 

## Why was this MR needed?

For nested groups feature(https://gitlab.com/gitlab-org/gitlab-ce/issues/2772). We need URI like `/group/subgroup/project` be routed correctly


## Does this MR meet the acceptance criteria?

- [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) 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 !7459
2016-11-24 04:31:54 +00:00
Dmitriy Zaporozhets 6683fdcfb0
Add nested groups support to the routing
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-11-23 14:08:36 +02:00
Douglas Barbosa Alexandre 267e27b0cd Remove code to clone Bitbucket repositories using SSH 2016-11-21 16:47:26 -08:00
Oren Kanner 8dd9a8b6e0 Allow admins to stop impersonating users without e-mail addresses
Resolves #24576

Modify the guard clause of the `ApplicationController#require_email`
before action to skip requests where an admin is impersonating the
current user.
2016-11-17 23:28:39 -05:00
Lin Jen-Shin 5416d0e083 Pass `@ref` along so we know which pipeline to show
Closes #23615
2016-10-24 22:26:06 +08:00
Sean McGivern 86dcb79be3 Merge branch 'master' into merge-conflicts-editor-2 2016-10-17 10:56:55 +01:00
Dmitriy Zaporozhets 2b9a25bd5a
Handle unmatched routing with not_found method
We need this to prevent routing error when user access URL like /123
when there is no resource located under such name

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2016-10-15 00:36:22 +03:00
Sean McGivern 241cca011f Fix specs 2016-10-13 14:16:34 -05:00
Sean McGivern 3f71c43e88 Allow setting content for resolutions
When reading conflicts:

1. Add a `type` field. `text` works as before, and has `sections`;
   `text-editor` is a file with ambiguous conflict markers that can only
   be resolved in an editor.
2. Add a `content_path` field pointing to a JSON representation of the
   file's content for a single file.
3. Hitting `content_path` returns a similar datastructure to the `file`,
   but without the `content_path` and `sections` fields, and with a
   `content` field containing the full contents of the file (with
   conflict markers).

When writing conflicts:

1. Instead of `sections` being at the top level, they are now in a
   `files` array. This matches the read format better.
2. The `files` array contains file hashes, each of which must contain:
   a. `new_path`
   b. `old_path`
   c. EITHER `sections` (which works as before) or `content` (with the
      full content of the resolved file).
2016-10-13 14:16:34 -05:00
Clement Ho b4d614bdbc Fix inconsistent highlighting of already selected activity nav-links 2016-10-05 15:38:18 -05:00
http://jneen.net/ 5853c96b49 remove Ability.abilities 2016-08-30 11:35:06 -07:00
Z.J. van de Weg 4c8e9a8d27 Remove gitorious 2016-08-25 10:10:10 +01:00
Stan Hu 170885edd6 Add Sentry logging to API calls
Closes #21043
2016-08-24 12:09:51 -07:00
zs 84a3225b0c State specific default sort order for issuables
Provide more sensible default sort order for issues and merge requests
based on the following table:

| type           | state  | default sort order |
|----------------|--------|--------------------|
| issues         | open   | last created       |
| issues         | closed | last updated       |
| issues         | all    | last created       |
| merge requests | open   | last created       |
| merge requests | merged | last updated       |
| merge requests | closed | last updated       |
| merge requests | all    | last created       |
2016-08-01 11:28:56 +02:00
Timothy Andrew 4b33c4c6d1 Load Javascript U2F library selectively.
1. Only on supported Chrome versions

2. Mainly, this lets us simplify the javascript-based U2F check to
   `window.u2f`, where `window.u2f` can either be loaded from the GitLab
   server (for Chrome) or from the Firefox extension.

3. This is a better way to provide browser detection for U2F.
2016-07-14 08:19:09 +05:30
Rémy Coutable 654565c9dc Raise a new Gitlab::Access::AccessDeniedError when permission is not enough to destroy a member
This is a try for a new approach to put the access checks at the service level.

Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-06-18 06:06:34 +02:00
Douwe Maan 9b7fd74805 Merge branch 'feature/project-export' into 'master'
Export project functionality

This is a MR for the export functionality of https://gitlab.com/gitlab-org/gitlab-ce/issues/3050, which adds the ability to export single projects.

- [x] members
- DB data
  - [x] issues
  - [x] issue comments
  - [x] merge requests
  - [x] merge request diff
  - [x] merge request comments
  - [x] labels
  - [x] milestones
  - [x] snippets
  - [x] releases
  - [x] events
  - [x] commit statuses
  - [x] CI builds
- File system data
  - [x] Git repository
  - [x] wiki
  - [x] uploads
  - [ ] ~~CI build traces~~
  - [ ] ~~CI build artifacts~~
  - [ ] ~~LFS objects~~
- DB configuration
  - [x] services
  - [x] web hooks
  - [x] protected branches
  - [x] deploy keys
  - [x] CI variables
  - [x] CI triggers

See merge request !3114
2016-06-17 15:35:27 +00:00
Timothy Andrew 7ee0898a9e Implement @DouweM's feedback.
- Extract a duplicated `redirect_to`
- Fix a typo: "token", not "certificate"
- Have the "Expires at" datepicker be attached to a text field, not inline
- Have both private tokens and personal access tokens verified in a
  single "authenticate_from_private_token" method, both in the
  application and API. Move relevant logic to
  `User#find_by_personal_access_token`
- Remove unnecessary constants relating to API auth. We don't need a
  separate constant for personal access tokens since the param is the
  same as for private tokens.
2016-06-16 08:24:13 +05:30
Timothy Andrew d0bcba1105 Merge remote-tracking branch 'origin/master' into 2979-personal-access-tokens 2016-06-14 09:06:53 +05:30
James Lopez e83fc684a5 Merge branches 'feature/project-export-ui-experimental' and 'feature/project-import' of gitlab.com:gitlab-org/gitlab-ce into feature/project-export-ui-experimental
# Conflicts:
#	Gemfile.lock
#	app/helpers/todos_helper.rb
#	app/models/todo.rb
#	app/views/projects/edit.html.haml
#	lib/gitlab/import_export/import_service.rb
2016-06-13 14:00:19 +02:00
Timothy Andrew 1779d68bfe Merge remote-tracking branch 'origin/master' into 2979-personal-access-tokens 2016-06-09 14:40:14 +05:30
Douwe Maan 8c3ba8d6c9 Add workhorse controller and API helpers 2016-06-06 13:16:30 +02:00
Timothy Andrew 128549f10b Implement U2F registration.
- Move the `TwoFactorAuthsController`'s `new` action to `show`, since
  the page is not used to create a single "two factor auth" anymore. We
  can have a single 2FA authenticator app, along with any number of U2F
  devices, in any combination, so the page will be accessed after the
  first "two factor auth" is created.
- Add the `u2f` javascript library, which provides an API to the
  browser's U2F implementation.
- Add tests for the JS components
2016-06-06 12:50:31 +05:30
Timothy Andrew 791cc9138b Add a `U2fRegistrations` table/model.
- To hold registrations from U2F devices, and to authenticate them.
- Previously, `User#two_factor_enabled` was aliased to the
  `otp_required_for_login` column on `users`.
- This commit changes things a bit:
    - `User#two_factor_enabled` is not a method anymore
    - `User#two_factor_enabled?` checks both the
      `otp_required_for_login` column, as well as `U2fRegistration`s
    - Change all instances of `User#two_factor_enabled` to
      `User#two_factor_enabled?`
- Add the `u2f` gem, and implement registration/authentication at the
  model level.
2016-06-06 12:50:31 +05:30
Timothy Andrew 0dff6fd714 Fix rubocop spec. 2016-06-03 10:11:36 +05:30
Timothy Andrew ae0d8222af Merge remote-tracking branch 'origin/master' into 2979-personal-access-tokens 2016-06-03 09:31:16 +05:30
Robert Speicher 7d33fba7af Merge branch 'upgrade-devise-two-factor' into 'master'
Upgrade devise, devise-two-factor, and attr_encrypted

Devise 4 includes support for Rails 5, working towards #14286. devise-async doesn't support Devise 4.0 and in 4.1 the bug that was blocking using Devise's built-in ActiveJob integration was fixed. So devise-async is removed. devise-two-factor 3.0.0 is required for Devise 4 support.

attr_encrypted and encryptor are optional but recommended upgrades for devise-two-factor 3.0.0. The mode and algorithm will need to be changed in order to update to attr_encrypted 4.x in the future.

See merge request !4216
2016-06-02 00:44:41 +00:00
Timothy Andrew 6d44433176 Don't look for personal access tokens in the DB when the parameter/header is not passed. 2016-06-01 14:09:17 +05:30
Timothy Andrew 05b319b0b4 Perform private token and personal access token authentication in the same `before_action`.
- So that the check for valid personal access tokens happens only if
  private token auth fails.
2016-06-01 14:04:38 +05:30
Felipe Artur 56f3b243ce Add leading comment space cop 2016-05-31 19:33:46 -03:00
Connor Shea d47b2b92c9
Upgrade devise and devise-two-factor, remove devise-async
Devise (3.5.4 => 4.1.1) Changelog:
https://github.com/plataformatec/devise/blob/master/CHANGELOG.md

devise-two-factor (2.0.1 => 3.0.0) Changelog:
https://github.com/tinfoil/devise-two-factor/blob/master/CHANGELOG.md

These are reliant on each other, so they have to be upgraded together.

devise-async is no longer necessary as Devise 4.1 fixes a bug with the
ActiveJob integration.
2016-05-30 13:51:21 -06:00
Gabriel Mazetto f5a0ac0fc1 Codestyle: make sure we have space around operators 2016-05-13 04:46:56 -03:00
Timothy Andrew d915e7d5ca Reuse the private token param and header for personal access tokens.
- https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3749#note_11626427
- Personal access tokens are still a separate entity as far as the
  codebase is concerned - they just happen to use the same entry point
  as private tokens.
- Update tests and documentation to reflect this change
2016-05-11 10:16:23 +05:30
Timothy Andrew 2e9742997d Merge remote-tracking branch 'origin/master' into 2979-personal-access-tokens 2016-05-11 09:52:58 +05:30
James Lopez 6fe8b5da1f Merge branch 'feature/project-import' of gitlab.com:gitlab-org/gitlab-ce into feature/project-export-ui-experimental 2016-05-09 18:06:20 +02:00
Artem Sidorenko d6c2d6bab9 Use sign out path only if not empty 2016-05-03 22:10:49 +02:00
Timothy Andrew bafbf22c6a Address @DouweM's feedback on !3749.
- Use `TokenAuthenticatable` to generate the personal access token
- Remove a check for `authenticity_token` in application controller;
  this should've been `authentication_token`, maybe, and doesn't make
  any sense now.
- Have the datepicker appear inline
2016-04-28 22:28:36 +05:30
Timothy Andrew 051324e12a Refactor `authenticate_user_from_private_token!`
- No need to use `if`s when we have a `presence` check already.
2016-04-28 22:28:36 +05:30
Timothy Andrew ade40fdcd2 Authenticate non-API requests with personal access tokens.
- Rename the `authenticate_user_from_token!` filter to
  `authenticate_user_from_private_token!`
- Add a new `authenticate_user_from_personal_access_token!` filter
- Add tests for both.
2016-04-28 22:28:36 +05:30
James Lopez acf297955a gitlab import UI - icon, file selector, etc... Also updated font-awesome and modified import source settings. 2016-04-22 17:44:59 +02:00
Robert Speicher f583129767 Add Sentry program context even without a current user 2016-04-14 13:56:30 -04:00
Stan Hu e450892f56 Include GonHelper separately and remove created_at in factory 2016-04-14 07:25:27 -07:00
Stan Hu c7e384aab2 Add spec for deletion of authorized OAuth2 application
Closes #14370

Move gon function into its own helper
2016-04-14 07:24:58 -07:00
Robert Speicher 2378ec0d63 Add a `program` tag to Sentry Raven context
This will let us filter errors by the program environment in which they
were encountered.

Source: http://stackoverflow.com/a/28370539/223897

Closes #15092
2016-04-09 19:57:27 -04:00
Douwe Maan ae7b2ef62c Merge branch 'master' into issue_12658
# Conflicts:
#	app/models/issue.rb
#	app/views/projects/_home_panel.html.haml
#	app/views/shared/projects/_project.html.haml
#	db/schema.rb
#	spec/models/project_spec.rb
2016-03-21 23:22:21 +01:00
Douwe Maan 8db1292139 Tweaks, refactoring, and specs 2016-03-20 21:04:07 +01:00
Robert Speicher 085538c2bd Use the configured Kaminari "per page" default 2016-03-19 17:37:54 -04:00