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
6703354f
Commit
6703354f
authored
Feb 19, 2016
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests and other small improvements
parent
f74cb73a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
6 deletions
+21
-6
app/workers/ldap_group_links_worker.rb
app/workers/ldap_group_links_worker.rb
+1
-1
app/workers/ldap_sync_worker.rb
app/workers/ldap_sync_worker.rb
+3
-1
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+1
-1
spec/lib/gitlab/ldap/access_spec.rb
spec/lib/gitlab/ldap/access_spec.rb
+16
-3
No files found.
app/workers/ldap_group_links_worker.rb
View file @
6703354f
...
...
@@ -3,7 +3,7 @@ class LdapGroupLinksWorker
def
perform
(
user_id
)
user
=
User
.
find
(
user_id
)
logger
.
info
"Updating LDAP group memberships for user
#{
user
.
id
}
(
#{
user
.
username
}
)"
logger
.
info
"Updating LDAP group memberships for user
#{
user
.
id
}
(
#{
user
.
email
}
)"
access
=
Gitlab
::
LDAP
::
Access
.
new
(
user
)
access
.
update_ldap_group_links
end
...
...
app/workers/ldap_sync_worker.rb
View file @
6703354f
...
...
@@ -8,7 +8,9 @@ class LdapSyncWorker
Rails
.
logger
.
info
"Performing daily LDAP sync task."
User
.
ldap
.
find_each
(
batch_size:
100
).
each
do
|
ldap_user
|
Rails
.
logger
.
debug
"Syncing user
#{
ldap_user
.
username
}
,
#{
ldap_user
.
email
}
"
Gitlab
::
LDAP
::
Access
.
allowed?
(
ldap_user
,
update_groups:
true
)
# Use the 'update_ldap_group_links_synchronously' option to avoid creating a ton
# of new Sidekiq jobs all at once.
Gitlab
::
LDAP
::
Access
.
allowed?
(
ldap_user
,
update_ldap_group_links_synchronously:
true
)
end
end
end
lib/gitlab/ldap/access.rb
View file @
6703354f
...
...
@@ -77,7 +77,7 @@ module Gitlab
def
update_permissions
(
options
)
if
group_base
.
present?
if
options
[
:update_
groups
]
if
options
[
:update_
ldap_group_links_synchronously
]
update_ldap_group_links
else
LdapGroupLinksWorker
.
perform_async
(
user
.
id
)
...
...
spec/lib/gitlab/ldap/access_spec.rb
View file @
6703354f
...
...
@@ -117,18 +117,19 @@ describe Gitlab::LDAP::Access, lib: true do
end
describe
'#update_permissions'
do
subject
{
access
.
update_permissions
}
subject
{
access
.
update_permissions
(
options
)
}
let
(
:options
)
{
Hash
.
new
}
it
'does update group permissions with a group base configured'
do
allow
(
access
).
to
receive_messages
(
group_base:
'my-group-base'
)
expect
(
access
).
to
receive
(
:update_ldap_group_links
)
expect
(
LdapGroupLinksWorker
).
to
receive
(
:perform_async
).
with
(
user
.
id
)
subject
end
it
'does not update group permissions without a group base configured'
do
allow
(
access
).
to
receive_messages
(
group_base:
''
)
expect
(
access
).
not_to
receive
(
:update_ldap_group_links
)
expect
(
LdapGroupLinksWorker
).
not_to
receive
(
:perform_async
)
subject
end
...
...
@@ -146,6 +147,18 @@ describe Gitlab::LDAP::Access, lib: true do
subject
end
context
'when synchronously updating group permissions'
do
let
(
:options
)
{
{
update_ldap_group_links_synchronously:
true
}
}
it
'updates group permissions directly'
do
allow
(
access
).
to
receive_messages
(
group_base:
'my-group-base'
)
expect
(
LdapGroupLinksWorker
).
not_to
receive
(
:perform_async
)
expect
(
access
).
to
receive
(
:update_ldap_group_links
)
subject
end
end
end
describe
:update_kerberos_identity
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