Commit Graph

11 Commits

Author SHA1 Message Date
Thong Kuah a2cfc150ce Add # frozen_string_literal to spec/models
Adds `# frozen_string_literal: true` to spec/models ruby files
2019-04-01 14:37:54 +13:00
Stan Hu ab4aba7065 Fix failed LDAP logins when nil user_id present
When a LDAP user signs in the for the first time and if there
is an `Identity` object with `user_id` of `nil`, new users
will not be able to be register until that entry is cleared
because of the way identities are created:

1. First, the User object is built but not saved, so it has no `id`.
2. Then, `user.identities.build(provider: 'ldapmain')` is called,
   but it does not have an associated `user_id` as a result.
3. `User#save` is called, but the `Identity` validation fails if an
   existing entry with `user_id` of `nil` already exists.

The uniqueness validation for `nil` values doesn't make any sense in
this case. We should be enforcing this at the database level with a
foreign key constraint. To work around the issue we can validate
against the user instead, which does the right thing even when
the user isn't saved yet.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56734
2019-01-29 11:15:06 -08:00
Francisco Javier López 26af0e2d60 Fixed user synced attributes metadata after removing current provider 2018-02-15 09:27:38 +00:00
Francisco Javier López 8c6b5baba1 LDAP extern_uids are not normalized when updated via API 2017-12-21 14:31:15 +00:00
Francisco Javier López c7cf68bd6f Changing OAuth lookup to be case insensitive 2017-11-17 14:24:25 +00:00
Douwe Maan 8399de0c96 Normalize LDAP DN when looking up identity 2017-10-31 17:13:50 +01:00
Rémy Coutable ddccd24c13 Remove superfluous lib: true, type: redis, service: true, models: true, services: true, no_db: true, api: true
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-27 14:31:53 +02:00
Grzegorz Bizon 9e211091a8 Enable Style/EmptyLines cop, remove redundant ones 2016-07-01 21:56:17 +02:00
Jeroen van Baarsen f1479b56b7
Remove the annotate gem and delete old annotations
In 8278b763d9 the default behaviour of annotation
has changes, which was causing a lot of noise in diffs. We decided in #17382
that it is better to get rid of the whole annotate gem, and instead let people
look at schema.rb for the columns in a table.

Fixes: #17382
2016-05-09 18:00:28 +02:00
Gabriel Mazetto ac6a10f3e8 Codestyle changes 2016-01-12 12:29:10 -02:00
Gabriel Mazetto ec67e9be1d Repair ldap_blocked state when no ldap identity exist anymore 2016-01-08 16:26:04 -02:00