2113 Commits
Author SHA1 Message Date
Dmitriy ZaporozhetsandMarin Jankovski 325cedebe3 Merge branch 'fix-broken-new-project-import' into 'master'
Fix OAuth2 issue importing a new project from GitHub and GitLab

It appears that the GitLab OAuth2 client options were converted to strings instead of symbols when merged with the default options (i.e. `{}.merge(github_options)`). As a result, the OAuth2 defaults were being used. For example, the OAuth2 client options would have a key with `authorize_url` and `:authorize_url`, but the former was never used. As a result, the OAuth2 client would always use the wrong URL to talk to GitHub.

Note that this bug should also have affected GitLab, but not Bitbucket: The OAuth client is careful to convert all keys to symbols.

Closes #1268

See merge request !425
2015-03-24 12:23:52 -07:00
Douwe MaanandMarin Jankovski 6b3cff19e9 Merge pull request #8995 from MichaelAlt/patch-1
Faulty LDAP DN name escaping removed
2015-03-24 12:19:33 -07:00
Dmitriy Zaporozhets 5909e5f6b2 Revert "Increase timeout for Git-over-HTTP requests."
This reverts commit 516bcabbf4.

Conflicts:
	Gemfile
2015-03-19 22:47:46 -07:00
Marin Jankovski 9e0715c0a3 Merge branch '7-9-stable' of dev.gitlab.org:gitlab/gitlabhq into 7-9-stable 2015-03-19 10:32:18 -07:00
Dmitriy ZaporozhetsandMarin Jankovski 1ea6b05e87 Merge branch 'rake_backup' into 'master'
Backup repo with tar instead of git bundle

Fixes gitlab/gitlab-ee#246

See merge request !1723
2015-03-19 10:19:14 -07:00
Marin Jankovski d793de7ad7 Commits in push data should always be an array. 2015-03-18 23:32:57 -07:00
Marin JankovskiandDmitriy Zaporozhets 09657f1071 Move application setting to separate variable. 2015-03-18 14:04:29 -07:00
Vinnie OkadaandDmitriy Zaporozhets 33d5a60571 Handle nil restricted visibility settings
Return `true` from `non_restricted_level?` when the
`restricted_visibility_levels` setting is nil.
2015-03-18 14:04:17 -07:00
Douwe Maan e4ac6bbf82 Merge branch 'atom-xhtml-squashed' into 'master'
Fix invalid Atom feeds when using emoji, horizontal rules, or images

This is a fix for issues #880, #723, #1113.

Markdown must be rendered to XHTML, not HTML, when generating summary content for Atom feeds. Otherwise, content-less tags like *img* and *hr* are not terminated and make the Atom XML invalid. Such tags are generated when issue descriptions, merge request descriptions, comments, or commit messages use emoji, horizontal rules, or images.

To pass this option through from the relevant Haml templates to the proper place in the `gfm()` method, a new method `gfm_with_options()` is introduced. It reuses the options dictionary passed to `markdown()` and interprets options `xhtml` and `parse_tasks` from it (the latter was a convenient replacement for `gfm_with_tasks()`). `xhtml` is already interpreted by Redcarpet::Render::HTML, but that alone was not sufficient, because the post-processing in `gfm()` would convert its XHTML tags back to HTML.

I found no way of passing additional optional options to the existing `gfm()` method without requiring updates to existing callers and without getting in the way of the existing optional arguments, but maybe someone who knows more about Ruby than I can think of one.

Thorough review appreciated since this is the first time I have used Ruby.

See merge request !344
2015-03-17 08:38:38 +00:00
Dmitriy Zaporozhets 3a324d9c6d Revert "Merge branch 'backup-permissions' into 'master'"
This reverts commit c42262b43b, reversing
changes made to c6586b1283.
2015-03-16 23:51:46 -07:00
Dmitriy Zaporozhets c42262b43b Merge branch 'backup-permissions' into 'master'
Change permissions on backup files

Use more restrictive permissions for backup tar files and for the db, uploads, and repositories directories inside the tar files.  See #1894.  Now the backup task recursively `chmod`s the `db/`, `uploads/`, and `repositories/` folders with 0700 permissions, and the tar file is created as 0600.

cc @sytse

See merge request !1703
2015-03-17 02:13:44 +00:00
Christian Walther 90aa870c36 Fix invalid Atom feeds when using emoji, horizontal rules, or images.
Fixes issues #880, #723, #1113: Markdown must be rendered to XHTML, not HTML, when generating summary content for Atom feeds. Otherwise, content-less tags like <img> and <hr>, generated when issue descriptions, merge request descriptions, comments, or commit messages use emoji, horizontal rules, or images, are not terminated and make the Atom XML invalid.
2015-03-16 22:05:52 +01: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
Zeger-Jan van de Weg 67f55d9b25 Let the server fix unconfigured git 2015-03-16 16:28:20 +01:00
Vinnie Okada 8587a29370 Change permissions on backup files
Use more restrictive permissions for backup tar files and for the db,
uploads, and repositories directories inside the tar files.
2015-03-15 13:14:30 -06: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
Vasilij Schneidermann 6235b027ec Fix typo 2015-03-14 10:22:06 +01:00
Dmitriy Zaporozhets afb694886e Merge branch 'ldap-unblock-user' into 'master'
Unblock user if they were unblocked in AD.

Fixes problem with !1687.

See merge request !1694
2015-03-13 22:25:47 +00:00
Douwe Maan 8fed435208 Unblock user if they were unblocked in AD. 2015-03-13 22:34:11 +01:00
Dmitriy Zaporozhets b8f5e23f27 Merge branch 'tag-branch-hooks' into 'master'
Execute hooks and services when branch or tag is created or deleted through web interface.

Fixes #2095.

Split up into commits to make it easier to see why what was changed :)

See merge request !1692
2015-03-13 16:42:01 +00:00
Douwe Maan 4e49f21b14 Set push data object kind in PushDataBuilder. 2015-03-13 14:51:48 +01:00
Douwe Maan 2718955441 Fix import pages not working after first load. 2015-03-13 13:47:26 +01:00
Dmitriy Zaporozhets e7f4f0ae1d Block user if he/she was blocked in Active Directory 2015-03-12 11:53:21 -07:00
Dmitriy Zaporozhets 59621e9034 Merge branch 'blue-theme' into 'master'
Add blue theme to GitLab

See merge request !1682
2015-03-12 17:09:55 +00:00
Dmitriy Zaporozhets 158507d942 Add blue theme to GitLab 2015-03-11 21:29:11 -07:00
Dmitriy Zaporozhets f29a7ce51f Merge branch 'markdown-smb-link' into 'master'
Allow smb:// links in Markdown text.

As requested by Sam McLeod at https://gitlab.com/gitlab-org/gitlab-ce/issues/1184

See merge request !1669
2015-03-12 03:57:52 +00:00
Marin Jankovski 1647994ada Merge branch 'fix-code-preview' into 'master'
Fix code preview theme setting for comments, issues, merge requests, and snippets

User color scheme was not being used: default white color scheme was always chosen. Also, default background for code in notes was always overriding the user color scheme.

Closes #1139

See merge request !357
2015-03-11 18:41:36 +00:00
Dmitriy Zaporozhets b2f6567961 Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce 2015-03-11 09:57:59 -07:00
Dmitriy Zaporozhets e349ca1353 Merge branch 'ldap-filter-eq' into 'master'
Escape wildcards when searching LDAP by username.

Addresses https://dev.gitlab.org/gitlab/gitlabhq/issues/2086.

Also see https://dev.gitlab.org/gitlab/gitlab-ee/merge_requests/344 and https://dev.gitlab.org/gitlab/omniauth-ldap/merge_requests/2.

See merge request !1644
2015-03-11 16:57:28 +00:00
Hannes Rosenögger b0c1bc6657 Merge branch 'generate-valid-json' into 'master'
Generate valid json

This patch helps to be compatible to other programing languages as it improves the validation of hook data. It seems only ruby can handle 'nil' as value while other json decode function will fatal.

See merge request !182
2015-03-11 16:53:10 +00: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
Dmitriy Zaporozhets ae7e380632 Add active users to gitlab:check 2015-03-10 12:03:04 -07:00
Stan Hu 4218a2bfcf Fix code preview theme setting for comments, issues, merge requests, and snippets.
Also preserve code preview color scheme in events dashboard.

Assign default colors to all code blocks shown as <pre class="code highlight [color_scheme]">

Closes #1139
2015-03-10 08:11:20 -07:00
Douwe Maan 383c56efa1 Use Gitlab::Git helper methods and constants as much as possible. 2015-03-10 13:39:31 +01:00
Douwe Maan ca9aca9279 Allow smb:// links in Markdown text. 2015-03-10 13:32:28 +01:00
Nicole Cordes b7a31a4b02 Generate valid json for hooks
It seems that ruby can handle 'nil' value but other json processors
(like PHP) throw an error. This is always generated for empty arrays.
2015-03-10 10:07:25 +01: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
Dmitriy Zaporozhets 83e60cc2b9 Merge branch 'commit-range-reference' into 'master'
Automatically link commit ranges to compare page.

Closes #2103

Implemented as proposed in the last paragraph of the issue:

> We could do something similar to Ruby, where `1..5` means `1,2,3,4,5` and `1...5` means `1,2,3,4`: `..` means inclusive, `...` means exclusive. In our case, `sha1...sha4` would mean `sha2,sha3,sha4` (exclusive with regards to `sha1`) and `sha1..sha4` would mean `sha1^...sha4`, i.e. `sha1,sha2,sha3,sha4` (inclusive to `sha1`).

- `sha1...sha4` now links to `compare/sha1...sha4`
- `sha1..sha4` now links to `compare/sha1^...sha4`.

See merge request !1649
2015-03-08 23:39:04 +00: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
Vinnie Okada cacac147de Move restricted visibility settings to the UI
Add checkboxes to the application settings page for restricted
visibility levels, and remove those settings from gitlab.yml.
2015-03-07 13:11:08 -07:00
Douwe Maan 4dddaef866 Automatically link commit ranges to compare page. 2015-03-07 00:46:13 +01: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
Stan Hu 7e204cf389 Added comment notification events to HipChat and Slack services.
Supports four different event types all bundled under the "note" event type:

- comments on a commit
- comments on an issue
- comments on a merge request
- comments on a code snippet
2015-03-06 06:54:00 -08:00
Douwe Maan 757dca2b78 Escape wildcards when searching LDAP by username. 2015-03-06 13:39:57 +01:00
Dmitriy Zaporozhets d07b2e09fe Merge branch 'timeout' into 'master'
Increase timeout for Git-over-HTTP requests.

Fixes #2081 and https://gitlab.com/gitlab-org/gitlab-ce/issues/232.

Normal web requests are bound by the `Rack::Timeout` timeout of 60 seconds, while Grack Git-over-HTTP requests are only bound by Unicorn's timeout which is now set to 1 hour, which should be plenty.

The omnibus package should be updated to no longer use `unicorn['worker_timeout']` for the Unicorn timeout, but to set the `Slowpoke.timeout`.

See merge request !1619
2015-03-05 02:28:58 +00:00
Douwe Maan 516bcabbf4 Increase timeout for Git-over-HTTP requests. 2015-03-04 23:20:47 +01:00
Dmitriy Zaporozhets 63178a9509 Merge branch 'add-more-slack-notifications' into 'master'
Add more Slack notifications for issue and merge request events

From https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/237 by Stan Hu.

See merge request !1556
2015-03-04 21:57:17 +00:00
Valery Sizov 3d9a766d9f Web Hook sends email of pusher 2015-03-04 20:29:25 +02:00