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
Boxiang Sun
gitlab-ce
Commits
1e666ce6
Commit
1e666ce6
authored
Jan 28, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport LDAP user assignment changes from EE
See
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/146
parent
ca171b81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+8
-7
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
1e666ce6
...
@@ -21,15 +21,16 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
...
@@ -21,15 +21,16 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
# We only find ourselves here
# We only find ourselves here
# if the authentication to LDAP was successful.
# if the authentication to LDAP was successful.
def
ldap
def
ldap
@user
=
Gitlab
::
LDAP
::
User
.
new
(
oauth
)
ldap_user
=
Gitlab
::
LDAP
::
User
.
new
(
oauth
)
@user
.
save
if
@user
.
changed?
# will also save new users
ldap_user
.
save
if
ldap_user
.
changed?
# will also save new users
gl_user
=
@user
.
gl_user
gl_user
.
remember_me
=
params
[
:remember_me
]
if
@user
.
persisted?
@user
=
ldap_user
.
gl_user
@user
.
remember_me
=
params
[
:remember_me
]
if
ldap_user
.
persisted?
# Do additional LDAP checks for the user filter and EE features
# Do additional LDAP checks for the user filter and EE features
if
@
user
.
allowed?
if
ldap_
user
.
allowed?
log_audit_event
(
gl_
user
,
with: :ldap
)
log_audit_event
(
@
user
,
with: :ldap
)
sign_in_and_redirect
(
gl_
user
)
sign_in_and_redirect
(
@
user
)
else
else
flash
[
:alert
]
=
"Access denied for your LDAP account."
flash
[
:alert
]
=
"Access denied for your LDAP account."
redirect_to
new_user_session_path
redirect_to
new_user_session_path
...
...
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