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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e23a26ae
Commit
e23a26ae
authored
Oct 03, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add provider context to Ldap::Access
parent
0e276f9c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+12
-6
lib/gitlab/ldap/user.rb
lib/gitlab/ldap/user.rb
+1
-1
No files found.
lib/gitlab/ldap/access.rb
View file @
e23a26ae
# LDAP authorization model
#
# * Check if we are allowed access (not blocked)
# * Update authorizations and associations
#
module
Gitlab
module
Gitlab
module
LDAP
module
LDAP
class
Access
class
Access
attr_reader
:adapter
attr_reader
:adapter
,
:provider
def
self
.
open
(
&
block
)
def
self
.
open
(
provider
,
&
block
)
Gitlab
::
LDAP
::
Adapter
.
open
do
|
adapter
|
Gitlab
::
LDAP
::
Adapter
.
open
(
provider
)
do
|
adapter
|
block
.
call
(
self
.
new
(
adapter
))
block
.
call
(
self
.
new
(
provider
,
adapter
))
end
end
end
end
def
self
.
allowed?
(
user
)
def
self
.
allowed?
(
user
)
self
.
open
do
|
access
|
self
.
open
(
user
.
provider
)
do
|
access
|
if
access
.
allowed?
(
user
)
if
access
.
allowed?
(
user
)
access
.
update_permissions
(
user
)
access
.
update_permissions
(
user
)
access
.
update_email
(
user
)
access
.
update_email
(
user
)
...
@@ -23,7 +28,8 @@ module Gitlab
...
@@ -23,7 +28,8 @@ module Gitlab
end
end
end
end
def
initialize
(
adapter
=
nil
)
def
initialize
(
provider
,
adapter
=
nil
)
@provider
=
provider
@adapter
=
adapter
@adapter
=
adapter
end
end
...
...
lib/gitlab/ldap/user.rb
View file @
e23a26ae
...
@@ -66,7 +66,7 @@ module Gitlab
...
@@ -66,7 +66,7 @@ module Gitlab
def
find_by_uid_and_provider
def
find_by_uid_and_provider
# LDAP distinguished name is case-insensitive
# LDAP distinguished name is case-insensitive
model
.
model
.
where
(
provider:
auth_hash
.
provider
).
where
(
provider:
[
auth_hash
.
provider
,
:ldap
]
).
where
(
'lower(extern_uid) = ?'
,
auth_hash
.
uid
.
downcase
).
last
where
(
'lower(extern_uid) = ?'
,
auth_hash
.
uid
.
downcase
).
last
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