Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
gitlab-ce
Commits
d92f4280
Commit
d92f4280
authored
Aug 07, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor refactor
parent
4d2f3611
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
lib/gitlab/ldap/user.rb
lib/gitlab/ldap/user.rb
+8
-7
No files found.
lib/gitlab/ldap/user.rb
View file @
d92f4280
...
@@ -44,13 +44,14 @@ module Gitlab
...
@@ -44,13 +44,14 @@ module Gitlab
gl_user
.
skip_reconfirmation!
gl_user
.
skip_reconfirmation!
gl_user
.
email
=
auth_hash
.
email
gl_user
.
email
=
auth_hash
.
email
# If we don't have an identity for this provider yet, create one
# find_or_initialize_by doesn't update `gl_user.identities`, and isn't autosaved.
if
gl_user
.
identities
.
find_by
(
provider:
auth_hash
.
provider
).
nil?
identity
=
gl_user
.
identities
.
find
{
|
identity
|
identity
.
provider
==
auth_hash
.
provider
}
gl_user
.
identities
.
new
(
extern_uid:
auth_hash
.
uid
,
provider:
auth_hash
.
provider
)
identity
||=
gl_user
.
identities
.
build
(
provider:
auth_hash
.
provider
)
else
# Update the UID attribute for this provider in case it has changed
identity
=
gl_user
.
identities
.
select
{
|
identity
|
identity
.
provider
==
auth_hash
.
provider
}
# For a new user set extern_uid to the LDAP DN
identity
.
first
.
extern_uid
=
auth_hash
.
uid
# For an existing user with matching email but changed DN, update the DN.
end
# For an existing user with no change in DN, this line changes nothing.
identity
.
extern_uid
=
auth_hash
.
uid
gl_user
gl_user
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment