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
e08c14c0
Commit
e08c14c0
authored
Oct 03, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use provider based ldap config
parent
63132b75
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+9
-5
No files found.
lib/gitlab/ldap/access.rb
View file @
e08c14c0
...
...
@@ -42,17 +42,17 @@ module Gitlab
end
def
update_permissions
(
user
)
if
Gitlab
.
config
.
ldap
[
'sync_ssh_keys'
]
if
ldap_config
[
'sync_ssh_keys'
]
update_ssh_keys
(
user
)
end
# Skip updating group permissions
# if instance does not use group_base setting
return
true
unless
Gitlab
.
config
.
ldap
[
'group_base'
].
present?
return
true
unless
ldap_config
[
'group_base'
].
present?
update_ldap_group_links
(
user
)
if
Gitlab
.
config
.
ldap
[
'admin_group'
].
present?
if
ldap_config
[
'admin_group'
].
present?
update_admin_status
(
user
)
end
end
...
...
@@ -71,7 +71,7 @@ module Gitlab
(
ldap_user
.
ssh_keys
-
user
.
keys
.
ldap
.
pluck
(
:key
)).
each
do
|
key
|
Rails
.
logger
.
info
"
#{
self
.
class
.
name
}
: adding LDAP SSH key
#{
key
.
inspect
}
to
#{
user
.
name
}
(
#{
user
.
id
}
)"
new_key
=
LDAPKey
.
new
(
title:
"LDAP -
#{
Gitlab
.
config
.
ldap
[
'sync_ssh_keys'
]
}
"
,
key:
key
)
new_key
=
LDAPKey
.
new
(
title:
"LDAP -
#{
ldap_config
[
'sync_ssh_keys'
]
}
"
,
key:
key
)
new_key
.
user
=
user
unless
new_key
.
save
Rails
.
logger
.
error
"
#{
self
.
class
.
name
}
: failed to add LDAP SSH key
#{
key
.
inspect
}
to
#{
user
.
name
}
(
#{
user
.
id
}
)
\n
"
\
...
...
@@ -100,7 +100,7 @@ module Gitlab
end
def
update_admin_status
(
user
)
admin_group
=
Gitlab
::
LDAP
::
Group
.
find_by_cn
(
Gitlab
.
config
.
ldap
[
'admin_group'
],
adapter
)
admin_group
=
Gitlab
::
LDAP
::
Group
.
find_by_cn
(
ldap_config
[
'admin_group'
],
adapter
)
if
admin_group
.
has_member?
(
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
extern_uid
,
adapter
))
unless
user
.
admin?
user
.
admin
=
true
...
...
@@ -140,6 +140,10 @@ module Gitlab
end
.
map
(
&
:cn
)
end
def
ldap_config
Gitlab
::
LDAP
::
Adapter
.
config_for
(
provider
)
end
private
def
gitlab_groups_with_ldap_link
::
Group
.
includes
(
:ldap_group_links
).
references
(
:ldap_group_links
).
...
...
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