Commit Graph

242 Commits

Author SHA1 Message Date
Timothy Andrew 53aa043724
Fix specs for the ghost user feature. 2017-02-24 16:50:21 +05:30
Timothy Andrew 8e68480976
Use a `ghost` boolean to track ghost users.
Rather than using a separate `ghost` state. This lets us have the benefits of
both ghost and blocked users (ghost: true, state: blocked) without having to
rewrite a number of queries to include cases for `state: ghost`.
2017-02-24 16:50:20 +05:30
Timothy Andrew ca16c3734b
Extract code from `Namespace#clean_path` for ghost user generation.
1. Create a `Uniquify` class, which generalizes the process of generating unique
   strings, by accepting a function that defines what "uniqueness" means in a
   given context.

2. WIP: Make sure tests for `Namespace` pass, add more if necessary.

3. WIP: Add tests for `Uniquify`
2017-02-24 16:50:19 +05:30
Timothy Andrew ff19bbd3b4
Deleting a user shouldn't delete associated issues.
- "Associated" issues are issues the user has created + issues that the
  user is assigned to.

- Issues that a user owns are transferred to a "Ghost User" (just a
  regular user with `state = 'ghost'` that is created when
  `User.ghost` is called).

- Issues that a user is assigned to are moved to the "Unassigned" state.

- Fix a spec failure in `profile_spec` — a spec was asserting that when a user
  is deleted, `User.count` decreases by 1. After this change, deleting a user
  creates (potentially) a ghost user, causing `User.count` not to change. The
  spec has been updated to look for the relevant user in the assertion.
2017-02-24 16:50:19 +05:30
Douwe Maan 56de781a2c Revert "Enable Style/DotPosition"
This reverts commit e00fb2bdc2090e9cabeb1eb35a2672a882cc96e9.

# Conflicts:
#	.rubocop.yml
#	.rubocop_todo.yml
#	lib/gitlab/ci/config/entry/global.rb
#	lib/gitlab/ci/config/entry/jobs.rb
#	spec/lib/gitlab/ci/config/entry/factory_spec.rb
#	spec/lib/gitlab/ci/config/entry/global_spec.rb
#	spec/lib/gitlab/ci/config/entry/job_spec.rb
#	spec/lib/gitlab/ci/status/build/factory_spec.rb
#	spec/lib/gitlab/incoming_email_spec.rb
2017-02-23 09:33:19 -06:00
Douwe Maan 1fe7501b49 Revert "Prefer leading style for Style/DotPosition"
This reverts commit cb10b725c8929b8b4460f89c9d96c773af39ba6b.
2017-02-23 09:33:05 -06:00
Douwe Maan 75f5fa997d Enable Rails/Delegate 2017-02-23 09:32:42 -06:00
Douwe Maan 206953a430 Prefer leading style for Style/DotPosition 2017-02-23 09:32:22 -06:00
Douwe Maan 3dadf306dd Enable Style/DotPosition 2017-02-23 09:31:56 -06:00
Annabel Dunstone Gray c780ad0e92 Remove all instances of theme_id; require downtime 2017-02-15 13:31:18 -06:00
Annabel Dunstone Gray 0667d1aa7f Drop theme ID from users table 2017-02-15 13:31:18 -06:00
Pawel Chojnacki e31b982a13 Make deploy key not show in User's keys list 2017-02-13 15:38:00 +01:00
Reza Mohammadi d9ee55ee38 Bypass signup domain validation for external users
Fixes #25279
2017-02-08 13:04:07 +03:30
Douwe Maan 50f5960c72 Merge branch 'ee-1439-read-only-user' into 'master'
Backport changes from gitlab-org/gitlab-ee!998

See merge request !8984
2017-02-07 04:10:13 +00:00
Douwe Maan 46dff6910d More backport 2017-02-06 17:19:37 -06:00
Douwe Maan 937cb72763 Update spec 2017-02-06 13:50:56 -06:00
Semyon Pupkov 3deb66ea56 Add traits for ProjectFeatures to Project factory
https://gitlab.com/gitlab-org/gitlab-ce/issues/24007
2017-02-05 13:11:45 +05:00
Robert Speicher e48a1755f4 Add traits for the different Event types to the Event factory 2017-02-01 16:02:03 -05:00
Robert Speicher fcb37542e7 Use `:empty_project` where possible in model specs 2017-01-26 17:44:59 -05:00
Dmitriy Zaporozhets 8a9597fc73 Merge branch 'dz-nested-groups-access-improvements' into 'master'
Nested groups feature improvemetns

See merge request !8448
2017-01-25 13:17:43 +00:00
Dmitriy Zaporozhets 52c5f9c97f
Add User#nested_groups and User#nested_projects methods
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2017-01-25 13:43:15 +02:00
Poornima M 8354c76f39 Fixing sort of Users so that users who never logged in will be displayed last
Adding changelog entry
2017-01-24 18:42:55 +05:30
Robert Speicher 1502d564fd Convert most User model specs to use `:empty_project` 2017-01-19 16:44:25 -05:00
Rémy Coutable d95b709a66
Be smarter when finding a sudoed user in API::Helpers
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-13 15:53:00 +01:00
Rémy Coutable 5186618bb0 Merge branch '25209-improve-length-validators' into 'master'
Use :maximum instead of :within for length validators with a 0..N range

Closes #25209

See merge request !7894
2016-12-07 10:31:21 +00:00
Rémy Coutable 4e249d5bae
Use :maximum instead of :within for length validators with a 0..N range
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-06 10:23:17 +01:00
Andrew Smith a527fab1f5 Test all values for `enabled_git_access_protocol` 2016-12-02 22:33:55 +10:00
Andrew Smith 532f8cbd38 If SSH prototol is disabled don't say the user requires SSH keys 2016-12-01 22:13:42 +10:00
Yorick Peterse 92b2c74ce1
Refresh project authorizations using a Redis lease
When I proposed using serializable transactions I was hoping we would be
able to refresh data of individual users concurrently. Unfortunately
upon closer inspection it was revealed this was not the case. This could
result in a lot of queries failing due to serialization errors,
overloading the database in the process (given enough workers trying to
update the target table).

To work around this we're now using a Redis lease that is cancelled upon
completion. This ensures we can update the data of different users
concurrently without overloading the database.

The code will try to obtain the lease until it succeeds, waiting at
least 1 second between retries. This is necessary as we may otherwise
end up _not_ updating the data which is not an option.
2016-11-25 13:35:01 +01: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
Douwe Maan 130c8a5198 Merge branch 'feature/precalculate-authorized-projects' into 'master'
Precalculate authorized projects in database

## What does this MR do?
It caches user's authorized projects in database instead of using multiple unions, which should simplify and speed-up things since this operation (getting authorized projects) is used a lot.

## Are there points in the code the reviewer needs to double check?
Did we miss a scenario where we need to refresh the list of projects?

## Does this MR meet the acceptance criteria?

- [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry 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?
#23150 

See merge request !6839
2016-11-18 19:42:17 +00:00
Ahmad Sherif fd05e26618 Precalculate user's authorized projects in database
Closes #23150
2016-11-18 20:25:45 +02:00
Rémy Coutable 726a414169 Merge branch 'chat-name-authorize' into 'master'
Allows to authorize chat user against GitLab.

This is needed for: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7438

See merge request !7450
2016-11-17 18:08:24 +00:00
Nick Thomas 606afe2e81 Fix some failing specs due to missing access_requestable trait 2016-11-16 19:19:22 +00:00
Rémy Coutable 2e1fe59e37 Merge branch 'patch-5' into 'master'
Fix issue where "Without projects" filter admin area shows 0 users incorrectly. Before this fix, if any outstanding group or project invitations exist the count show as 0.

Fixes #3367

See merge request !6611
2016-11-16 16:58:32 +00:00
Kamil Trzcinski d64183e1fa Add most of specs for chat names 2016-11-16 14:56:30 +01:00
Ben Bodenmiller 00d9d7678b fix "Without projects" filter 2016-11-16 01:49:45 -08:00
Nick Thomas d211011698 Make access request specs explicitly enable or disable access requests as required 2016-11-11 15:45:47 +00:00
Yorick Peterse 467b346f06
Add User#projects_with_reporter_access_limited_to
This method can be used to retrieve a list of projects for a user that
said user has reporter access to. This list is then be reduced down to
a specific set of projects. This allows you to reduce a list of projects
to a list of projects you have reporter access to in an efficient
manner.
2016-11-07 12:49:24 +01:00
Valery Sizov b7dff1b072 Fix: Todos Filter Shows All Users 2016-11-04 13:41:14 +02:00
Yar f853058010 Allow to search for user by secondary email address in the admin interface
It is not possible to search for a user by his secondary email address in
the Users search bar in the admin interface(/admin/users). A use-case could
 be that an admin wants to remove a specific secondary email address of an
user, because it interferes with another user. Issue #23761

This commit adds ability to search not only by main email, but also
by any secondary email in the admin interface.
2016-11-01 17:58:03 +03:00
David Wagner 03b6108f6f Remove redundant class_name and foreign_key overrides
They were Rails' default and are unnecessarily overridden.

Signed-off-by: David Wagner <david@marvid.fr>
2016-10-24 22:29:48 +02:00
Yorick Peterse 16ed9b6129
Refactor Gitlab::Identifier
This refactors Gitlab::Identifier so it uses fewer queries and is
actually tested. Queries are reduced by caching the output as well as
using 1 query (instead of 2) to find a user using an SSH key.
2016-10-05 12:40:17 +02:00
Felipe Artur 892dea6771 Project tools visibility level 2016-09-01 11:47:59 -03:00
Paco Guzman cfe512d6e9 Show "Create Merge Request" widget for push events to fork projects on the source project 2016-08-24 18:54:26 +02:00
Paco Guzman 03386633a4 Move to project dropdown with infinite scroll for better performance
Use just SQL to check is a user can admin_issue on a project

Tradeoff

- we duplicate how we check admin_issue in a SQL relation in the Ability class
2016-08-17 07:33:51 +02:00
Lin Jen-Shin d5264e8804 Simplify the name for data builder, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5620#note_13671791
2016-08-12 16:09:29 +08:00
Lin Jen-Shin 0b52517049 Merge remote-tracking branch 'upstream/master' into pipeline-hooks-without-slack
* upstream/master: (233 commits)
  Fix awardable button mutuality loading spinners
  Update CHANGELOG for 8.10.5
  Clean up project destruction
  Small refactor of doc/development/README.md
  Avoid commit lookup on diff_helper
  Removed extra newline from redis_spec.rb
  Used cached value of project count to reduce DB load
  Remove duplicate link_to statements
  Mention add_column_with_default in downtime guide
  Add missing space to generic badge template
  Rename `run` task helper method to prevent conflict with StateMachine
  Add a method in Project to return a cached value of total count of projects
  spellcheck
  Add svg guidelines to ui guide
  Add Changelog entry for Grape upgrade [ci skip]
  Fix Grape tests.
  Retain old behavior
  Update Grape from 0.13.0 to 0.15.0.
  adds second batch of tests changed to active tense
  fixes part1 of files to start using active tense
  ...
2016-08-11 13:35:35 +08:00
tiagonbotelho 1d268a89de adds second batch of tests changed to active tense 2016-08-09 15:11:39 +01:00
Lin Jen-Shin 984367f957 Move those builders to their own namespace, feedback:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5620#note_13540099
2016-08-04 23:44:27 +08:00