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
41a3c84e
Commit
41a3c84e
authored
Jul 09, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging code for LDAP keys
parent
526959ab
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+9
-2
No files found.
lib/gitlab/ldap/access.rb
View file @
41a3c84e
...
@@ -63,13 +63,20 @@ module Gitlab
...
@@ -63,13 +63,20 @@ module Gitlab
ldap_user
=
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
extern_uid
)
ldap_user
=
Gitlab
::
LDAP
::
Person
.
find_by_dn
(
user
.
extern_uid
)
user
.
keys
.
ldap
.
where
.
not
(
key:
ldap_user
.
ssh_keys
).
each
do
|
deleted_key
|
user
.
keys
.
ldap
.
where
.
not
(
key:
ldap_user
.
ssh_keys
).
each
do
|
deleted_key
|
deleted_key
.
destroy
Rails
.
logger
.
info
"
#{
self
.
class
.
name
}
: removing LDAP SSH key
#{
deleted_key
.
key
}
from
#{
user
.
name
}
(
#{
user
.
id
}
)"
unless
deleted_key
.
destroy
Rails
.
logger
.
error
"
#{
self
.
class
.
name
}
: failed to remove LDAP SSH key
#{
key
.
inspect
}
from
#{
user
.
name
}
(
#{
user
.
id
}
)"
end
end
end
(
ldap_user
.
ssh_keys
-
user
.
keys
.
ldap
.
pluck
(
:key
)).
each
do
|
key
|
(
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 -
#{
Gitlab
.
config
.
ldap
[
'sync_ssh_keys'
]
}
"
,
key:
key
)
new_key
.
user
=
user
new_key
.
user
=
user
new_key
.
save
unless
new_key
.
save
Rails
.
logger
.
error
"
#{
self
.
class
.
name
}
: failed to add LDAP SSH key
#{
key
.
inspect
}
to
#{
user
.
name
}
(
#{
user
.
id
}
)
\n
"
\
"error messages:
#{
new_key
.
errors
.
messages
}
"
end
end
end
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