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
212b406f
Commit
212b406f
authored
Oct 08, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ssh_sync_key to old convention to prevent confusion
parent
f488fd59
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
7 deletions
+8
-7
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+1
-1
lib/gitlab/ldap/config.rb
lib/gitlab/ldap/config.rb
+3
-2
lib/gitlab/ldap/person.rb
lib/gitlab/ldap/person.rb
+2
-2
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+2
-2
No files found.
lib/gitlab/ldap/access.rb
View file @
212b406f
...
...
@@ -79,7 +79,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 -
#{
ldap_config
.
s
sh_sync_key
}
"
,
key:
key
)
new_key
=
LDAPKey
.
new
(
title:
"LDAP -
#{
ldap_config
.
s
ync_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
"
\
...
...
lib/gitlab/ldap/config.rb
View file @
212b406f
...
...
@@ -24,10 +24,11 @@ module Gitlab
end
def
sync_ssh_keys?
s
sh_sync_key
.
present?
s
ync_ssh_keys
.
present?
end
def
ssh_sync_key
# The LDAP attribute in which the ssh keys are stored
def
sync_ssh_keys
options
[
'sync_ssh_keys'
]
end
...
...
lib/gitlab/ldap/person.rb
View file @
212b406f
...
...
@@ -47,8 +47,8 @@ module Gitlab
end
def
ssh_keys
if
config
.
sync_ssh_keys?
&&
entry
.
respond_to?
(
config
.
s
sh_sync_key
)
entry
[
config
.
s
sh_sync_key
.
to_sym
]
if
config
.
sync_ssh_keys?
&&
entry
.
respond_to?
(
config
.
s
ync_ssh_keys
)
entry
[
config
.
s
ync_ssh_keys
.
to_sym
]
else
[]
end
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
212b406f
...
...
@@ -70,7 +70,7 @@ describe Gitlab::LDAP::Access do
Net
::
LDAP
::
Entry
.
from_single_ldif_string
(
"dn: cn=foo, dc=bar, dc=com
\n
#{
ssh_key_attribute_name
}
:
#{
ssh_key
}
"
)
}
before
do
Gitlab
::
LDAP
::
Config
.
any_instance
.
stub
(
s
sh_sync_key
:
ssh_key_attribute_name
)
Gitlab
::
LDAP
::
Config
.
any_instance
.
stub
(
s
ync_ssh_keys
:
ssh_key_attribute_name
)
access
.
stub
sync_ssh_keys?:
true
end
...
...
@@ -87,7 +87,7 @@ describe Gitlab::LDAP::Access do
access
.
update_ssh_keys
expect
(
user
.
keys
.
last
.
title
).
to
match
(
/LDAP/
)
expect
(
user
.
keys
.
last
.
title
).
to
match
(
/
#{
access
.
ldap_config
.
s
sh_sync_key
}
/
)
expect
(
user
.
keys
.
last
.
title
).
to
match
(
/
#{
access
.
ldap_config
.
s
ync_ssh_keys
}
/
)
end
it
"should not add a SSH key if it is invalid"
do
...
...
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