summaryrefslogtreecommitdiff
path: root/app/models/user.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo on User modelDouglas Barbosa Alexandre2016-02-021-1/+1
|
* Support Akismet spam checking for creation of issues via APIStan Hu2016-02-021-0/+1
| | | | | | | Currently any spam detected by Akismet by non-members via API will be logged in a separate table in the admin page. Closes #5612
* Allow LDAP users to change their email if it was not set by the LDAP serverDouwe Maan2016-01-191-1/+4
|
* fixed LDAP activation on login to use new ldap_blocked statefeature/ldap-sync-edgecasesGabriel Mazetto2016-01-141-0/+1
|
* Repair ldap_blocked state when no ldap identity exist anymoreGabriel Mazetto2016-01-081-0/+1
|
* Add ldap_blocked as new state to users state machineGabriel Mazetto2016-01-081-1/+11
|
* Annotate modelsStan Hu2016-01-061-56/+57
|
* Prevent duplicate "username has already been taken" validation messagers-issue-201Robert Speicher2016-01-021-1/+4
| | | | Closes #201 - two-year-old bug, woo! :boom: :tada:
* Merge branch 'add_email_unlock' into 'master' Robert Speicher2015-12-211-0/+1
|\ | | | | | | | | | | | | | | | | | | | | Allow account unlock via email We see a lot of users get confused about what it means when your account gets locked. Many try to reset their password and are still faced with a lockout. With this change, users receive an email that allows them to unlock their account immediately. The previous behavior where the account is auto-unlocked after a time also still works. See merge request !2049
| * Allow account unlock via emailDrew Blessing2015-12-141-0/+1
| |
* | Fixed Rubocop offensesGabriel Mazetto2015-12-151-3/+3
|/
* Merge branch 'master' into ci/persist-registration-tokenGrzegorz Bizon2015-12-141-4/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (66 commits) Fix runners admin view Fix migrations Rename mention of gitlab-git-http-server to gitlab-workhorse Bump Redis requirement to 2.8 for Sidekiq 4 requirements Fix wording on runner setup page add details on how to change saml button label Fix tests Move awards back to gray panel and few improvements to sidebar Few UI improvements to new sidebar implementation Fix tests for new issuable sidebar Update changelog Implement new sidebar for merge request page Make edit link on issuable sidebar works Redesign issue page for new sidebar Move awards css to separate file Implement issuable sidebar partial Update CHANGELOG Clarify cache behavior Run builds from projects with enabled CI Use Gitlab::Git instead of Ci::Git ... Conflicts: db/schema.rb
| * Remove ci_ prefix from all ci related thingsKamil Trzcinski2015-12-111-1/+1
| |
| * Migrate CI::Project to ProjectKamil Trzcinski2015-12-111-3/+2
| |
* | Refactor `TokenAuthenticatable` to improve reusabilityGrzegorz Bizon2015-12-111-1/+3
|/ | | | | | | This adds a ability to use multiple different authentication token fields in other models. From now on it is necessary to add authentication token field manually in each class that implements this mixin.
* Update annotationsStan Hu2015-12-081-0/+1
|
* Add custom NamespaceValidatorRobert Speicher2015-12-071-4/+2
|
* fix deprecation messages in testsValery Sizov2015-12-031-1/+1
|
* git rid of deprecated warningsdeprecated_warningsValery Sizov2015-12-021-0/+5
|
* Merge pull request #9670 from janten/gravatar-retinaStan Hu2015-11-261-2/+2
|\ | | | | Add support for HiDPI displays in gravatar service
| * Fix merge errorJan-Gerd Tenberge2015-10-221-17/+30
| |\
| * | Add scale argument in user classJan-Gerd Tenberge2015-09-261-2/+2
| | |
* | | Use "GitLab.com" instead of "gitlab.com"atom-feed-latest-updateYorick Peterse2015-11-181-1/+1
| | |
* | | Don't pluck project IDs in User#owned_projectsYorick Peterse2015-11-181-4/+2
| | | | | | | | | | | | This won't work efficiently if you happen to have a lot of projects.
* | | Apply CI scope changes to the User modelYorick Peterse2015-11-181-6/+10
| | | | | | | | | | | | | | | | | | These changes are based on those from commit 03f5ff750b107b30a6d306aafb6699a9c9ecff0d, except they use a UNION instead of plucking IDs into memory.
* | | Refactor User#authorized_groups/projectsYorick Peterse2015-11-181-29/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods no longer include public groups/projects (that don't belong to the actual user) as this is handled by the various finder classes now. This also removes the need for passing extra arguments. Note that memoizing was removed _explicitly_. For whatever reason doing so messes up the users controller to a point where it claims a certain user does _not_ have access to certain groups/projects when it does have access. Existing code shouldn't be affected as these methods are only called in ways that they'd run queries anyway (e.g. a combination of "any?" and "each" which would run 2 queries regardless of memoizing).
* | | Refactor getting user groups/projects/contributionsYorick Peterse2015-11-181-16/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This new setup no longer loads any IDs into memory using "pluck", instead using SQL UNIONs to merge the various datasets together. This results in greatly improved query performance as well as a reduction of memory usage. The old setup was in particular problematic when requesting the authorized projects _including_ public/internal projects as this would result in roughly 65000 project IDs being loaded into memory. These IDs would in turn be passed to other queries.
* | | Prefix table names for User UNIONsYorick Peterse2015-11-181-2/+3
| | |
* | | Use SQL::Union for User#authorized_groupsYorick Peterse2015-11-181-4/+7
| | | | | | | | | | | | This removes the need for plucking any IDs into Ruby.
* | | Use SQL::Union for User#authorized_projectsYorick Peterse2015-11-181-21/+19
| | | | | | | | | | | | | | | | | | This allows retrieving of the list of authorized projects using a single query, without having to load any IDs into Ruby. This in turn also means we can remove the method User#authorized_projects_id.
* | | Show specific runners from projects where user is master or ownerci-runners-master-or-ownerKamil Trzcinski2015-11-161-5/+10
| | |
* | | Annotate modelsDmitriy Zaporozhets2015-11-131-0/+1
| | | | | | | | | | | | Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* | | Use a subquery with IDs only for find_by_any_emailYorick Peterse2015-10-301-9/+7
| | | | | | | | | | | | | | | | | | | | | This further improves performance of User.find_by_any_email and is roughly twice as fast as the previous UNION setup. Thanks again to @dlemstra for suggesting this.
* | | Fixed UNION syntax for MySQLYorick Peterse2015-10-301-2/+2
| | | | | | | | | | | | MySQL doesn't support the previous syntax.
* | | Use a UNION for User.find_by_any_emailYorick Peterse2015-10-301-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is significantly faster than using a sub-query, at least when run on the GitLab.com production database. The benchmarks are a lot slower now with these changes, most likely due to PostgreSQL choosing a different (and less efficient) plan based on the amount of data present in the test database. Thanks to @dlemstra for suggesting the use of a UNION.
* | | Improve performance of User.find_by_any_emailYorick Peterse2015-10-301-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This query used to rely on a JOIN, effectively producing the following SQL: SELECT users.* FROM users LEFT OUTER JOIN emails ON emails.user_id = users.id WHERE (users.email = X OR emails.email = X) LIMIT 1; The use of a JOIN means having to scan over all Emails and users, join them together and then filter out the rows that don't match the criteria (though this step may be taken into account already when joining). In the new setup this query instead uses a sub-query, producing the following SQL: SELECT * FROM users WHERE id IN (select user_id FROM emails WHERE email = X) OR email = X LIMIT 1; This query has the benefit that it: 1. Doesn't have to JOIN any rows 2. Only has to operate on a relatively small set of rows from the "emails" table. Since most users will only have a handful of Emails associated (certainly not hundreds or even thousands) the size of the set returned by the sub-query is small enough that it should not become problematic. Performance of the old versus new version can be measured using the following benchmark: # Save this in ./bench.rb require 'benchmark/ips' email = 'yorick@gitlab.com' def User.find_by_any_email_old(email) user_table = arel_table email_table = Email.arel_table query = user_table. project(user_table[Arel.star]). join(email_table, Arel::Nodes::OuterJoin). on(user_table[:id].eq(email_table[:user_id])). where(user_table[:email].eq(email).or(email_table[:email].eq(email))) find_by_sql(query.to_sql).first end Benchmark.ips do |bench| bench.report 'original' do User.find_by_any_email_old(email) end bench.report 'optimized' do User.find_by_any_email(email) end bench.compare! end Running this locally using "bundle exec rails r bench.rb" produces the following output: Calculating ------------------------------------- original 1.000 i/100ms optimized 93.000 i/100ms ------------------------------------------------- original 11.103 (± 0.0%) i/s - 56.000 optimized 948.713 (± 5.3%) i/s - 4.743k Comparison: optimized: 948.7 i/s original: 11.1 i/s - 85.45x slower In other words, the new setup is 85x faster compared to the old setup, at least when running this benchmark locally. For GitLab.com these improvements result in User.find_by_any_email taking only ~170 ms to run, instead of around 800 ms. While this is "only" an improvement of about 4.5 times (instead of 85x) it's still significantly better than before. Fixes #3242
* | | Fix specific runner visibilityKamil Trzcinski2015-10-261-9/+14
| |/ |/|
* | Merge branch 'cristianbica/gitlab-ce-user-project-view-files' into 'master' Dmitriy Zaporozhets2015-10-191-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow users to select the Files view as default project view ![Screen_Shot_2015-10-17_at_19.24.01](/uploads/c3194db856f5e5e1b3493302c0a479a5/Screen_Shot_2015-10-17_at_19.24.01.png) Also shows the readme at the very bottom, like on the regular Files page. Replaces !1489. Closes #2655. See merge request !1632
| * \ Merge branch 'master' into cristianbica/gitlab-ce-user-project-view-filesDouwe Maan2015-10-171-9/+19
| |\ \
| * | | Allow users to select the Files view as default project viewCristian Bica2015-10-011-1/+1
| | | |
* | | | Fix nonatomic database update potentially causing project star counts to go ↵Stan Hu2015-10-171-6/+9
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | negative The counter_cache decrement function is called when a project star is deleted, but there was no guarantee multiple workers would not attempt to delete the same item simultaneously. Use an atomic update to prevent the count from going negative. Closes #3067
* | | Improve performance of User.by_loginuser-by-login-performanceYorick Peterse2015-10-151-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Performance is improved in two steps: 1. On PostgreSQL an expression index is used for checking lower(email) and lower(username). 2. The check to determine if we're searching for a username or Email is moved to Ruby. Thanks to @haynes for suggesting and writing the initial implementation of this. Moving the check to Ruby makes this method an additional 1.5 times faster compared to doing the check in the SQL query. With performance being improved I've now also tweaked the amount of iterations required by the User.by_login benchmark. This method now runs between 900 and 1000 iterations per second.
* | | Merge branch 'user-preferences-layout-option' of ↵Dmitriy Zaporozhets2015-10-051-0/+4
|\ \ \ | | | | | | | | | | | | | | | | | | | | https://github.com/gopeter/gitlabhq into gopeter-user-preferences-layout-option Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
| * | | improved code style and layout option namingPeter Göbel2015-10-051-1/+1
| | | |
| * | | added user preference to change layout widthPeter Göbel2015-10-051-0/+4
| | | |
* | | | Add user to Ci::Build to have pusher email addressKamil Trzcinski2015-10-051-0/+1
|/ / /
* | | Merge remote-tracking branch 'upstream/master'Guilherme Garnier2015-10-031-0/+4
|\ \ \
| * \ \ Merge branch 'rs-throttle-reset' into 'master' Douwe Maan2015-10-021-0/+4
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Throttle "Forgot your password?" emails Addresses internal https://dev.gitlab.org/gitlab/gitlabhq/issues/2611 See merge request !1476
| | * | | Add User#recently_sent_password_reset?Robert Speicher2015-10-011-0/+4
| | |/ /
* | | | Fix rubocop warnings in appGuilherme Garnier2015-10-031-7/+1
|/ / /